#include #include #include template double test_atomic(int L, int N, int M,int K,int R,Kokkos::View offsets) { Kokkos::View output("Output",N); Kokkos::Impl::Timer timer; for(int r = 0; r double test_no_atomic(int L, int N, int M,int K,int R,Kokkos::View offsets) { Kokkos::View output("Output",N); Kokkos::Impl::Timer timer; for(int r = 0; r\n"); printf("Example Input GPU:\n"); printf(" Histogram : 1000000 1000 1 1000 1 10 1\n"); printf(" MD Force : 100000 100000 100 1000 20 10 4\n"); printf(" Matrix Assembly : 100000 1000000 50 1000 20 10 4\n"); Kokkos::finalize(); return 0; } int L = atoi(argv[1]); int N = atoi(argv[2]); int M = atoi(argv[3]); int D = atoi(argv[4]); int K = atoi(argv[5]); int R = atoi(argv[6]); int type = atoi(argv[7]); Kokkos::View offsets("Offsets",L,M); Kokkos::Random_XorShift64_Pool<> pool(12371); Kokkos::fill_random(offsets,pool,D); double time = 0; if(type==1) time = test_atomic(L,N,M,K,R,offsets); if(type==2) time = test_atomic(L,N,M,K,R,offsets); if(type==3) time = test_atomic(L,N,M,K,R,offsets); if(type==4) time = test_atomic(L,N,M,K,R,offsets); if(type==5) time = test_atomic >(L,N,M,K,R,offsets); double time2 = 1; if(type==1) time2 = test_no_atomic(L,N,M,K,R,offsets); if(type==2) time2 = test_no_atomic(L,N,M,K,R,offsets); if(type==3) time2 = test_no_atomic(L,N,M,K,R,offsets); if(type==4) time2 = test_no_atomic(L,N,M,K,R,offsets); if(type==5) time2 = test_no_atomic >(L,N,M,K,R,offsets); int size = 0; if(type==1) size = sizeof(int); if(type==2) size = sizeof(long); if(type==3) size = sizeof(float); if(type==4) size = sizeof(double); if(type==5) size = sizeof(Kokkos::complex); printf("%i\n",size); printf("Time: %s %i %i %i %i %i %i (t_atomic: %e t_nonatomic: %e ratio: %lf )( GUpdates/s: %lf GB/s: %lf )\n", (type==1)?"int": ( (type==2)?"long": ( (type==3)?"float": ( (type==4)?"double":"complex"))), L,N,M,D,K,R,time,time2,time/time2, 1.e-9*L*R*M/time, 1.0*L*R*M*2*size/time/1024/1024/1024); } Kokkos::finalize(); }