mxInitGPU (C) - Initialize MATLAB GPU library on currently selected device - MATLAB (original) (raw)

Main Content

Initialize MATLAB GPU library on currently selected device

C Syntax

#include "gpu/mxGPUArray.h" int mxInitGPU()

Returns

int type with one of the following values:

Description

Before using any CUDA code in your MEX file, initialize the MATLAB GPU library if you intend to use any mxGPUArray functionality in MEX or any GPU calls in MATLAB. There are many ways to initialize the MATLAB GPU API, including:

You should call mxInitGPU at the beginning of your MEX file, unless you have an alternate way of guaranteeing that the MATLAB GPU library is initialized at the start of your MEX file.

If the library is initialized, this function returns without doing any work. If the library is not initialized, the function initializes the default device. Note: At present, a MATLAB MEX file can work with only one GPU device at a time.

Version History

Introduced in R2013a