cublasHandle sharing + lock

Signed-off-by: raver119 <raver119@gmail.com>
master
raver119 2019-09-02 16:52:28 +03:00
parent 18828f9725
commit 2129d5bcac
1 changed files with 2 additions and 1 deletions

View File

@ -1184,9 +1184,10 @@ public class CudaZeroHandler implements MemoryHandler {
protected synchronized cublasHandle_t getCudaCublasHandle(OpaqueLaunchContext lc) {
val deviceId = Nd4j.getAffinityManager().getDeviceForCurrentThread();
if (cublasHandles.get(deviceId) == null)
if (cublasHandles.get(deviceId) == null) {
cublasHandles.remove(deviceId);
cublasHandles.add(deviceId, new cublasHandle_t(nativeOps.lcBlasHandle(lc)));
}
return cublasHandles.get(deviceId);
}