18 {
19 if(argc != 3) {
20 std::cerr << "Usage: Bit_Compare(Integer_t const N, Integer_t const dloc)" << std::endl;
21 std::exit(EX_USAGE);
22 }
26
27 magma_init();
28 magma_queue_t queue = NULL;
29 magma_int_t dev = 0;
30 magma_getdevice( &dev );
31 magma_queue_create( dev, &queue );
32
34 Integer_t const LDT = magma_roundup(nTot, GPU_UNIT);
35 matrix_gpu<Integer_t> dRes(LDT, N);
36
39 struct cudaFuncAttributes
attr; cudaFuncGetAttributes(&
attr, funcPtr);
44 Bit_gpuMatrixElementsInSector<<<conf.dimGrid(),conf.dimBlock(),conf.shared(),conf.stream()>>>(dRes.ptr(), dRes.LD(), N, dloc, nTot);
45 cudaDeviceSynchronize();
46
47
48 matrix<Integer_t> Res(nTot, N);
49 magma_getmatrix(nTot, N,
sizeof(
Integer_t), dRes.ptr(), dRes.LD(), &*Res.begin(), nTot, queue);
50
51 bool flag;
53 flag = true;
55 if(Res.at(n,pos) != Bit(n, pos, dloc, N)) { flag = false; break; };
56 }
57 if(flag == false) std::cerr << "Bit(" << n << ") != Bit_gpu" << std::endl;
58 else std::cerr << "(OK, n=" << n << ") Bit = Bit_gpu" << std::endl;
59 }
60
61
62
63
64 cudaDeviceSynchronize();
65 return 0;
66}
__global__ void Bit_gpu(Integer_t *dResPtr, Integer_t const LD, Integer_t const N, Integer_t const dloc, Integer_t const nTot)
Definition Bit_Compare.cu:9
Definition mytypes.hpp:272
struct cudaFuncAttributes attr
Definition getAttributesOfMatrixElementsInSector.cpp:2
Integer_t const nBlock
Definition getAttributesOfMatrixElementsInSector.cpp:5
Integer_t const nThread
Definition getAttributesOfMatrixElementsInSector.cpp:4
MKL_INT Integer_t
Definition mytypes.hpp:359