File: test_gpu_int32.m

package info (click to toggle)
mwrap 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,480 kB
  • sloc: cpp: 3,315; python: 1,850; ansic: 856; makefile: 255; lex: 233; sh: 145
file content (15 lines) | stat: -rw-r--r-- 463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function test_gpu_int32
% Test GPU int32 array passing via gpuArray.
% Requires: CUDA toolkit, mexcuda, GPU device.
% Run mwrap first:
%   ../mwrap -gpu -list -cppcomplex -mb -mex test_gpu_int32 -c test_gpu_int32.cu test_gpu_int32.mw

mexcuda test_gpu_int32.cu

a = int32((1:7)');
agpu = gpuArray(a);
bgpu = timestwo_gpu_int32(agpu);
b = gather(bgpu);
assert(norm(double(b) - 2*double(a)) == 0, 'GPU int32 timestwo failed');

fprintf('test_gpu_int32: PASSED\n');