Taking steps in the uncharted territories of eGPUs, I have installed an NVIDIA GeForce Titan Xp GPU on an eGPU enclosure (Mantiz MZ-02) and have connected it to my laptop (HP Spectre x360 - 15-bl075nr running Windows 10) using Thunderbolt 3. It seems my machine recognizes the device (since the name of the GPU is correctly listed?!). However, when I want to train a neural network using the external GPU, it gives me the following error (the code is from Mathematica Documentation and is self-contained).
Input:
n = 1000;
trainingData = RandomReal[1, {n, 4}] -> RandomReal[1, {n, 4}];
net = NetChain[{8, Tanh, 2048, Tanh, 2048, Tanh, 4}];
AbsoluteTiming[
trained =
NetTrain[net, trainingData, TargetDevice -> {"GPU", 2},
MaxTrainingRounds -> 10]
]
Output Error:
NetTrain::badtrgdev: TargetDevice -> {GPU,2} could not be used, please ensure that you have a compatible NVIDIA graphics card and have installed the latest operating system drivers.
My laptop does have an internal GPU (GeForce 940MX) and when I change TargetDevice -> {"GPU", 2}
to TargetDevice -> {"GPU", 1}
, everything works fine. How can I address this error?
Update
Good news, I was able to run the above code on a MacBook Pro (with Touch Bar) using my eGPU configuration. But when I run Needs["CUDALink`"]
followed by CUDAQ[]
to list all of my GPUs using SystemInformation[]
the Mathematica kernel crashes on my laptop, so I am not able to ensure that it recognizes the GPU or not. But when I unplug the eGPU and restart Mathematica, QUDAQ[]
returns True
.
Needs["MXNetLink`"]; MXNetLink`PackageScope`getGPUInformation[]
$\endgroup$TargetDevice -> "GPU"
are not related to one another, as such it is very strange that they seem to affect one another. What version of Mathematica are you using? 11.2 probably addressed many related problems. $\endgroup$