mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-11 21:12:38 +02:00
changed gpu interface for mpi
This commit is contained in:
parent
6f881607d8
commit
607c214284
7 changed files with 46 additions and 89 deletions
|
|
@ -15,6 +15,5 @@ from . import caching
|
|||
from . import diag
|
||||
from . import initialization
|
||||
from . import multioutput
|
||||
from . import linalg_gpu
|
||||
from . import parallel
|
||||
|
||||
|
|
|
|||
|
|
@ -16,33 +16,27 @@ try:
|
|||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
if MPI_enabled and MPI.COMM_WORLD.size>1:
|
||||
from .parallel import get_id_within_node
|
||||
gpuid = get_id_within_node()
|
||||
import pycuda.driver
|
||||
pycuda.driver.init()
|
||||
if gpuid>=pycuda.driver.Device.count():
|
||||
print('['+MPI.Get_processor_name()+'] more processes than the GPU numbers!')
|
||||
#MPI.COMM_WORLD.Abort()
|
||||
raise
|
||||
gpu_device = pycuda.driver.Device(gpuid)
|
||||
gpu_context = gpu_device.make_context()
|
||||
gpu_initialized = True
|
||||
else:
|
||||
import pycuda.autoinit
|
||||
gpu_initialized = True
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
from scikits.cuda import cublas
|
||||
import scikits.cuda.linalg as culinalg
|
||||
culinalg.init()
|
||||
cublas_handle = cublas.cublasCreate()
|
||||
except:
|
||||
pass
|
||||
|
||||
def initGPU():
|
||||
try:
|
||||
if MPI_enabled and MPI.COMM_WORLD.size>1:
|
||||
from .parallel import get_id_within_node
|
||||
gpuid = get_id_within_node()
|
||||
import pycuda.driver
|
||||
pycuda.driver.init()
|
||||
if gpuid>=pycuda.driver.Device.count():
|
||||
print('['+MPI.Get_processor_name()+'] more processes than the GPU numbers!')
|
||||
raise
|
||||
gpu_device = pycuda.driver.Device(gpuid)
|
||||
gpu_context = gpu_device.make_context()
|
||||
gpu_initialized = True
|
||||
else:
|
||||
import pycuda.autoinit
|
||||
gpu_initialized = True
|
||||
except:
|
||||
pass
|
||||
|
||||
def closeGPU():
|
||||
if gpu_context is not None:
|
||||
gpu_context.detach()
|
||||
|
|
|
|||
|
|
@ -61,12 +61,5 @@ try:
|
|||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import scikits.cuda.linalg as culinalg
|
||||
from scikits.cuda import cublas
|
||||
from scikits.cuda.cula import culaExceptions
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue