hl_cuda_stub.h 2.7 KB
Newer Older
Z
zhangjinchao01 已提交
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
/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#ifndef HL_CUDA_STUB_H_
#define HL_CUDA_STUB_H_

#include "hl_cuda.h"

inline void hl_start() {}

inline void hl_specify_devices_start(int *device, int number) {}

inline void hl_init(int device) {}

26
inline int hl_get_cuda_lib_version(int device) { return 0; }
Z
zhangjinchao01 已提交
27 28 29 30 31

inline void hl_fini() {}

inline void hl_set_sync_flag(bool flag) {}

32
inline bool hl_get_sync_flag() { return false; }
Z
zhangjinchao01 已提交
33

34
inline int hl_get_device_count() { return 0; }
Z
zhangjinchao01 已提交
35 36 37

inline void hl_set_device(int device) {}

38
inline int hl_get_device() { return 0; }
Z
zhangjinchao01 已提交
39

40
inline void *hl_malloc_device(size_t size) { return NULL; }
Z
zhangjinchao01 已提交
41 42 43

inline void hl_free_mem_device(void *dest_d) {}

44
inline void *hl_malloc_host(size_t size) { return NULL; }
Z
zhangjinchao01 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

inline void hl_free_mem_host(void *dest_h) {}

inline void hl_memcpy(void *dst, void *src, size_t size) {}

inline void hl_memset_device(void *dest_d, int value, size_t size) {}

inline void hl_memcpy_host2device(void *dest_d, void *src_h, size_t size) {}

inline void hl_memcpy_device2host(void *dest_h, void *src_d, size_t size) {}

inline void hl_memcpy_device2device(void *dest_d, void *src_d, size_t size) {}

inline void hl_rand(real *dest_d, size_t num) {}

inline void hl_srand(unsigned int seed) {}

62 63 64
inline void hl_memcpy_async(void *dst,
                            void *src,
                            size_t size,
Z
zhangjinchao01 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
                            hl_stream_t stream) {}

inline void hl_stream_synchronize(hl_stream_t stream) {}

inline void hl_create_event(hl_event_t *event) {}

inline void hl_destroy_event(hl_event_t event) {}

inline float hl_event_elapsed_time(hl_event_t start, hl_event_t end) {
  return 0;
}

inline void hl_stream_record_event(hl_stream_t stream, hl_event_t event) {}

inline void hl_stream_wait_event(hl_stream_t stream, hl_event_t event) {}

inline void hl_event_synchronize(hl_event_t event) {}

83
inline int hl_get_device_last_error() { return 0; }
Z
zhangjinchao01 已提交
84

85
inline const char *hl_get_device_error_string() { return NULL; }
Z
zhangjinchao01 已提交
86

87
inline const char *hl_get_device_error_string(size_t err) { return NULL; }
Z
zhangjinchao01 已提交
88

L
liaogang 已提交
89
inline bool hl_cuda_event_is_ready(hl_event_t event) { return true; }
Z
zhangjinchao01 已提交
90 91 92 93

inline void hl_device_synchronize() {}

#endif  // HL_CUDA_STUB_H_