GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — arrayfire-python/arrayfire/cuda.py at master · arrayfire/arrayfire-python Expand file tree/ Copy pathcuda.pyMore file actions 94 lines (71 loc) · 2.25 KB / Copy pathcuda.pyFile metadata and controls94 lines (71 loc) · 2.25 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 ####################################################### # Copyright (c) 2015, ArrayFire # All rights reserved. # # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: # http://arrayfire.com/licenses/BSD-3-Clause ######################################################## """ Functions specific to CUDA backend. This module provides interoperability with other CUDA libraries. """ def get_stream(idx): """ Get the CUDA stream used for the device `idx` by ArrayFire. Parameters ---------- idx : int. Specifies the index of the device. Returns ----------- stream : integer denoting the stream id. """ import ctypes as ct from .util import safe_call as safe_call from .library import backend as backend if (backend.name() != "cuda"): raise RuntimeError("Invalid backend loaded") stream = c_void_ptr_t(0) safe_call(backend.get().afcu_get_stream(c_pointer(stream), idx)) return stream.value def get_native_id(idx): """ Get native (unsorted) CUDA device ID Parameters ---------- idx : int. Specifies the (sorted) index of the device. Returns ----------- native_idx : integer denoting the native cuda id. """ import ctypes as ct from .util import safe_call as safe_call from .library import backend as backend if (backend.name() != "cuda"): raise RuntimeError("Invalid backend loaded") native = c_int_t(0) safe_call(backend.get().afcu_get_native_id(c_pointer(native), idx)) return native.value def set_native_id(idx): """ Set native (unsorted) CUDA device ID Parameters ---------- idx : int. Specifies the (unsorted) native index of the device. """ import ctypes as ct from .util import safe_call as safe_call from .library import backend as backend if (backend.name() != "cuda"): raise RuntimeError("Invalid backend loaded") safe_call(backend.get().afcu_set_native_id(idx)) return def set_cublas_mode(mode=CUBLAS_MATH_MODE.DEFAULT): """ Set's cuBLAS math mode for CUDA backend. In other backends, this has no effect. """ safe_call(backend().get().afcu_cublasSetMathMode(mode.value)) return |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |