concept cooperation in category parallel computing

This is an excerpt from Manning's book Parallel and High Performance Computing.
Last, we want to give you guidance on how to approach this chapter. We cover a lot of different languages in a short space. The proliferation of languages reflects the lack of cooperation among language developers at this point in time, as developers chase their immediate goals and hardware concerns. Rather than treat these languages as different languages, think of them as slightly different dialects of one or two languages. We recommend that you seek to learn a couple of these languages and appreciate the differences and similarities with the others. We will be comparing and contrasting the languages to help you see that they are not all that different once you get over the particular syntax of each and their quirks. We do expect that the languages will merge to a more common form, as the current situation is not sustainable. We already see the beginnings of that with the push for more language portability driven by the needs of large applications.
Listing 12.24 Stream triad example for Kokkos
Kokkos/StreamTriad/StreamTriad.cc 1 #include <Kokkos_Core.hpp> #A 2 3 using namespace std; 4 5 int main (int argc, char *argv[]) 6 { 7 Kokkos::initialize(argc, argv);{ #B 8 9 Kokkos::Timer timer; 10 double time1; 11 12 double scalar = 3.0; 13 size_t nsize = 1000000; 14 Kokkos::View<double *> a( "a", nsize); #C 15 Kokkos::View<double *> b( "b", nsize); #C 16 Kokkos::View<double *> c( "c", nsize); #C 17 18 cout << "StreamTriad with " << nsize << " elements" << endl; 19 20 Kokkos::parallel_for(nsize, KOKKOS_LAMBDA (int i) { #D 21 a[i] = 1.0; #D 22 }); #D 23 Kokkos::parallel_for(nsize, KOKKOS_LAMBDA (int i) { #D 24 b[i] = 2.0; #D 25 }); #D 26 27 timer.reset(); 28 29 Kokkos::parallel_for(nsize, KOKKOS_LAMBDA (const int i) { #D 30 c[i] = a[i] + scalar * b[i]; #D 31 }); #D 32 33 time1 = timer.seconds(); 34 35 icount = 0; 36 for (int i=0; i<nsize && icount < 10; i++){ 37 if (c[i] != 1.0 + 3.0*2.0) { 38 cout << "Error with result c[" << i << "]=" << c[i] << endl; 39 icount++; 40 } 41 } 42 43 if (icount == 0) cout << "Program completed without error." << endl; 44 cout << "Runtime is " << time1*1000.0 << " msecs " << endl; 45 46 } 47 Kokkos::finalize(); #E 48 return 0; 49 }