Skip to content

Commit 82917ec

Browse files
committed
add golang deps: c_api.h
1 parent 9fdfde6 commit 82917ec

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

kernel/c_api.h

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*!
2+
* Copyright (c) 2016 by Contributors
3+
* \file cvm/c_api.h
4+
* \brief C API of CVM symbolic construction and pass.
5+
* Enables construction and transformation of Graph
6+
* in any other host languages.
7+
*/
8+
#ifndef CVM_C_API_H_
9+
#define CVM_C_API_H_
10+
11+
/*! \brief CVM_DLL prefix for windows */
12+
#ifdef _WIN32
13+
#ifdef CVM_EXPORTS
14+
#define CVM_DLL __declspec(dllexport)
15+
#else
16+
#define CVM_DLL __declspec(dllimport)
17+
#endif
18+
#else
19+
#define CVM_DLL __attribute__((visibility("default")))
20+
#endif
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
const int SUCCEED = 0;
27+
const int ERROR_LOGIC = 1;
28+
const int ERROR_RUNTIME = 2;
29+
30+
int CVMAPILoadModel(const char *graph_json, int graph_strlen,
31+
const char *param_bytes, int param_strlen,
32+
void **net, // pass reference of network
33+
int device_type, int device_id);
34+
int CVMAPIFreeModel(void *net);
35+
int CVMAPIInference(void *net,
36+
char *input_data, int input_len,
37+
char *output_data);
38+
39+
int CVMAPIGetVersion(void *net, char *version);
40+
int CVMAPIGetPreprocessMethod(void *net, char *method);
41+
42+
int CVMAPIGetInputLength(void *net, unsigned long long *size);
43+
int CVMAPIGetOutputLength(void *net, unsigned long long *size);
44+
int CVMAPIGetInputTypeSize(void *net, unsigned long long *size);
45+
int CVMAPIGetOutputTypeSize(void *net, unsigned long long *size);
46+
47+
int CVMAPIGetStorageSize(void *net, unsigned long long *gas);
48+
int CVMAPIGetGasFromModel(void *net, unsigned long long *gas);
49+
int CVMAPIGetGasFromGraphFile(const char *graph_json, unsigned long long *gas);
50+
51+
#ifdef __cplusplus
52+
} /* end extern "C" */
53+
#endif
54+
55+
#endif // CVM_C_API_H_

kernel/dlopen.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <stdlib.h>
77
#include <stdint.h>
88
#include <stdio.h>
9-
#include "cvm/c_api.h"
9+
#include "c_api.h"
1010

1111
void* plugin_open(const char* path, char** err) {
1212
void* lib = dlopen(path, RTLD_NOW|RTLD_GLOBAL);

0 commit comments

Comments
 (0)