コード例 #1
0
1. Not all functions are ported.
2. Errors are translated into CUDARuntimeError exceptions.
3. The 'cuda' prefix of each API is omitted and the next character is set to
   lower case.
4. The resulting values are returned directly instead of references.

"""
import ctypes
import sys

from cupy.cuda import internal

if 'win32' == sys.platform:
    _cudart = internal.load_library(
        internal.get_windows_cuda_library_names('cudart'))
else:
    _cudart = internal.load_library('cudart')

###############################################################################
# Types
###############################################################################

Device = ctypes.c_int
Function = ctypes.c_void_p
Stream = ctypes.c_void_p
Event = ctypes.c_void_p

memcpyHostToHost = 0
memcpyHostToDevice = 1
memcpyDeviceToHost = 2
コード例 #2
0
ファイル: runtime.py プロジェクト: ryuuji5/chainer
1. Not all functions are ported.
2. Errors are translated into CUDARuntimeError exceptions.
3. The 'cuda' prefix of each API is omitted and the next character is set to
   lower case.
4. The resulting values are returned directly instead of references.

"""
import ctypes
import sys

from cupy.cuda import internal

if 'win32' == sys.platform:
    _cudart = internal.load_library(
        internal.get_windows_cuda_library_names('cudart'))
else:
    _cudart = internal.load_library('cudart')

###############################################################################
# Types
###############################################################################

Device = ctypes.c_int
Function = ctypes.c_void_p
Stream = ctypes.c_void_p
Event = ctypes.c_void_p

memcpyHostToHost = 0
memcpyHostToDevice = 1
memcpyDeviceToHost = 2