|
| 1 | +/******************************************************* |
| 2 | + * Copyright (c) 2019, ArrayFire |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * This file is distributed under 3-clause BSD license. |
| 6 | + * The complete license agreement can be obtained at: |
| 7 | + * http://arrayfire.com/licenses/BSD-3-Clause |
| 8 | + ********************************************************/ |
| 9 | + |
| 10 | +#include "symbol_manager.hpp" |
| 11 | +#include <af/backend.h> |
| 12 | + |
| 13 | +#define AF_DEFINE_CUDA_TYPES |
| 14 | +#include <af/cuda.h> |
| 15 | + |
| 16 | +af_err afcu_get_stream(cudaStream_t* stream, int id) { |
| 17 | + af_backend backend; |
| 18 | + af_get_active_backend(&backend); |
| 19 | + if(backend == AF_BACKEND_CUDA) { |
| 20 | + return CALL(stream, id); |
| 21 | + } |
| 22 | + return AF_ERR_NOT_SUPPORTED; |
| 23 | +} |
| 24 | + |
| 25 | +af_err afcu_get_native_id(int* nativeid, int id) { |
| 26 | + af_backend backend; |
| 27 | + af_get_active_backend(&backend); |
| 28 | + if(backend == AF_BACKEND_CUDA) { |
| 29 | + return CALL(nativeid, id); |
| 30 | + } |
| 31 | + return AF_ERR_NOT_SUPPORTED; |
| 32 | +} |
| 33 | + |
| 34 | + |
| 35 | +af_err afcu_set_native_id(int nativeid) { |
| 36 | + af_backend backend; |
| 37 | + af_get_active_backend(&backend); |
| 38 | + if(backend == AF_BACKEND_CUDA) { |
| 39 | + return CALL(nativeid); |
| 40 | + } |
| 41 | + return AF_ERR_NOT_SUPPORTED; |
| 42 | +} |
| 43 | + |
| 44 | + |
| 45 | +af_err afcu_cublasSetMathMode(cublasMath_t mode) { |
| 46 | + af_backend backend; |
| 47 | + af_get_active_backend(&backend); |
| 48 | + if(backend == AF_BACKEND_CUDA) { |
| 49 | + return CALL(mode); |
| 50 | + } |
| 51 | + return AF_ERR_NOT_SUPPORTED; |
| 52 | +} |
0 commit comments