• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_RUNTIME_API_H_
17 #define TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_RUNTIME_API_H_
18 
19 #include <cstddef>
20 typedef enum { cudaSuccess = 0, cudaErrorNotReady = 1 } cudaError_t;
21 
22 unsigned int cudaEventDefault = 0;
23 
24 enum cudaMemcpyKind {
25   cudaMemcpyHostToHost = 0,
26   cudaMemcpyHostToDevice = 1,
27   cudaMemcpyDeviceToHost = 2,
28   cudaMemcpyDeviceToDevice = 3
29 };
30 
31 struct CUstream_st {
32   int arch;
33 };
34 
35 typedef struct CUStream_st *cudaStream_t;
36 
37 cudaError_t cudaMalloc(void **devPtr, size_t size);
38 cudaError_t cudaFree(void *devPtr);
39 cudaError_t cudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind);
40 cudaError_t cudaMemGetInfo(size_t *free, size_t *total);
41 cudaError_t cudaStreamCreate(cudaStream_t *pStream);
42 cudaError_t cudaStreamDestroy(cudaStream_t stream);
43 cudaError_t cudaStreamSynchronize(cudaStream_t stream);
44 cudaError_t cudaGetDeviceCount(int *count);
45 cudaError_t cudaSetDevice(int device);
46 
47 #endif  // TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_RUNTIME_API_H_
48