mThrust demo 01

Illustration of basic mThrust command

Contents

Initilization of the mThrust toolbox

Thrust.init()
mThrust toolbox configuration 
  CUDA version : 8.0
  CUDA sms     : 30
  CUDA path    : /usr/local/cuda

Get properties of the GPU devices

cuda.GetDeviceProperties()
ans = 

  struct with fields:

                   Name: 'Quadro K1100M'
                  Index: 0
      ComputeCapability: '3.0'
         RuntimeVersion: 8
          DriverVersion: 8
            TotalMemory: 2.0939e+09
        AvailableMemory: 936968192
    MultiprocessorCount: 2
              CoresByMP: 192
              CudaCores: 384
     GPUMaxClockRateMhz: 705.5001
     MaxThreadsPerBlock: 1024
      SharedMemPerBlock: 49152
     MaxThreadBlockSize: [1024 1024 64]
            MaxGridSize: [2.1475e+09 65535 65535]

Get CUDA Thrust version

Thrust.version()
ans =

1.8.3

transfert on GPU device

H=[14,20,38,46];
D=mThrust(H,'device') % Transfert H to GPU device
D = 

 thrust::device_vector<double>[4]
 14  20  38  46  

Modify directly on the device

D([1,2])=[99,98]
D = 

 thrust::device_vector<double>[4]
 99  98  38  46