Running Matlab + GPU via Command Line

# Login to a GPU Node:

[fauowl@koko-login2 ~]$ srun –pty –gres gpu bash

# https://www.mathworks.com/help/distcomp/gpudevice.html

module load matlab

module load cuda90

module list # Verify modules loaded

 

# Start Matlab via CLI and verify GPUs

 

matlab

 

>> gpuDeviceCount

ans =

    1

 

>> d = gpuDevice

d =

 CUDADevice with properties:

                     Name: ‘TITAN X (Pascal)’

                    Index: 1

        ComputeCapability: ‘6.1’

           SupportsDouble: 1

            DriverVersion: 9.1000

           ToolkitVersion: 9.1000

       MaxThreadsPerBlock: 1024

         MaxShmemPerBlock: 49152

       MaxThreadBlockSize: [1024 1024 64]

              MaxGridSize: [2.1475e+09 65535 65535]

                SIMDWidth: 32

              TotalMemory: 1.2788e+10

          AvailableMemory: 1.2536e+10

      MultiprocessorCount: 28

             ClockRateKHz: 1911000

              ComputeMode: ‘Default’

     GPUOverlapsTransfers: 1

   KernelExecutionTimeout: 0

         CanMapHostMemory: 1

          DeviceSupported: 1

           DeviceSelected: 1

 

# Run GPU Examples # https://www.mathworks.com/help/distcomp/run-matlab-functions-on-a-gpu.html#mw_2854177c-d7a0-4f54-84e9-ea3fed725d08

Posted in HPC