def setUpClass(cls):
     if get_user_gpu_rank() == -1 or not MPI_IMPORTED:
         return
     cls.mpicomm = MPI.COMM_WORLD
     cls.size = cls.mpicomm.Get_size()
     cls.rank = cls.mpicomm.Get_rank()
     cls.ctx = gpuarray.init("cuda" + str(cls.rank))
     print("*** Collectives testing for", cls.ctx.devname, file=sys.stderr)
     cls.cid = GpuCommCliqueId(context=cls.ctx)
     cls.mpicomm.Bcast(cls.cid, root=0)
     cls.gpucomm = GpuComm(cls.cid, cls.size, cls.rank)
示例#2
0
 def setUpClass(cls):
     if get_user_gpu_rank() == -1 or not MPI_IMPORTED:
         return
     cls.mpicomm = MPI.COMM_WORLD
     cls.size = cls.mpicomm.Get_size()
     cls.rank = cls.mpicomm.Get_rank()
     cls.ctx = gpuarray.init("cuda" + str(cls.rank))
     print("*** Collectives testing for", cls.ctx.devname, file=sys.stderr)
     cls.cid = GpuCommCliqueId(context=cls.ctx)
     cls.mpicomm.Bcast(cls.cid.comm_id, root=0)
     cls.gpucomm = GpuComm(cls.cid, cls.size, cls.rank)
示例#3
0
dtypes_no_complex = ["float32", "float64",
                     "int8", "int16", "uint8", "uint16",
                     "int32", "int64", "uint32", "uint64"]

# Sometimes int8 is just a source of trouble (like with overflows)
dtypes_no_complex_big = ["float32", "float64", "int16", "uint16",
                         "int32", "int64", "uint32", "uint64"]

def get_env_dev():
    for name in ['COMPYTE_TEST_DEVICE', 'DEVICE']:
        if name in os.environ:
            return os.environ[name]
    return "opencl0:0"


context = gpuarray.init(get_env_dev())
print >>sys.stderr, "*** Testing for", context.devname


def guard_devsup(func):
    def f(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except gpuarray.UnsupportedException as e:
            raise SkipTest("operation not supported")
    return f


def rand(shape, dtype):
    r = numpy.random.randn(*shape) * 10
    if r.dtype.startswith('u'):
示例#4
0
文件: support.py 项目: heha180/array
dtypes_no_complex_big = [
    "float32", "float64", "int16", "uint16", "int32", "int64", "uint32",
    "uint64"
]


def get_env_dev():
    for name in ['GPUARRAY_TEST_DEVICE', 'DEVICE']:
        if name in os.environ:
            return os.environ[name]
    raise RuntimeError(
        "No test device specified.  Specify one using the DEVICE "
        "or GPUARRAY_TEST_DEVICE environment variables.")


context = gpuarray.init(get_env_dev())
print("*** Testing for", context.devname, file=sys.stderr)


def guard_devsup(func):
    def f(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except gpuarray.UnsupportedException as e:
            raise SkipTest("operation not supported")

    return f


def rand(shape, dtype):
    r = numpy.random.randn(*shape) * 10