提交 510ccfef 编写于 作者: Y Yu Yang

Make Paddle exports the symbols

上级 30a6f9b3
...@@ -185,3 +185,4 @@ if(CUDA_ARCH) ...@@ -185,3 +185,4 @@ if(CUDA_ARCH)
endif() endif()
set(CUDA_NVCC_FLAGS ${__arch_flags} ${CUDA_NVCC_FLAGS}) set(CUDA_NVCC_FLAGS ${__arch_flags} ${CUDA_NVCC_FLAGS})
...@@ -17,6 +17,11 @@ limitations under the License. */ ...@@ -17,6 +17,11 @@ limitations under the License. */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "config.h" #include "config.h"
// Since we only support linux and macos in compile, always use clang or
// gcc 4.8+. DLL_IMPORT/DLL_EXPORT is as simple as below.
#define PD_API __attribute__((visibility("default")))
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -44,28 +49,31 @@ typedef enum { ...@@ -44,28 +49,31 @@ typedef enum {
*/ */
typedef void* PD_IVector; typedef void* PD_IVector;
int PDIVecCreateNone(PD_IVector* ivec); PD_API int PDIVecCreateNone(PD_IVector* ivec);
int PDIVecDestroy(PD_IVector ivec); PD_API int PDIVecDestroy(PD_IVector ivec);
int PDIVectorGet(PD_IVector ivec, int** buffer); PD_API int PDIVectorGet(PD_IVector ivec, int** buffer);
/** /**
* Matrix functions. Return will be a PD_Error type. * Matrix functions. Return will be a PD_Error type.
*/ */
typedef void* PD_Matrix; typedef void* PD_Matrix;
int PDMatCreate(PD_Matrix* mat, uint64_t height, uint64_t width, bool useGpu); PD_API int PDMatCreate(PD_Matrix* mat,
uint64_t height,
uint64_t width,
bool useGpu);
int PDMatDestroy(PD_Matrix mat); PD_API int PDMatDestroy(PD_Matrix mat);
int PDMatCopyToRow(PD_Matrix mat, uint64_t rowID, pd_real* rowArray); PD_API int PDMatCopyToRow(PD_Matrix mat, uint64_t rowID, pd_real* rowArray);
int PDMatGetRow(PD_Matrix mat, uint64_t rowID, pd_real** rawRowBuffer); PD_API int PDMatGetRow(PD_Matrix mat, uint64_t rowID, pd_real** rawRowBuffer);
int PDMatCreateNone(PD_Matrix* mat); PD_API int PDMatCreateNone(PD_Matrix* mat);
int PDMatGetShape(PD_Matrix mat, uint64_t* height, uint64_t* width); PD_API int PDMatGetShape(PD_Matrix mat, uint64_t* height, uint64_t* width);
/** /**
* Arguments functions. Each argument means layer output. Arguments means a * Arguments functions. Each argument means layer output. Arguments means a
...@@ -73,48 +81,48 @@ int PDMatGetShape(PD_Matrix mat, uint64_t* height, uint64_t* width); ...@@ -73,48 +81,48 @@ int PDMatGetShape(PD_Matrix mat, uint64_t* height, uint64_t* width);
*/ */
typedef void* PD_Arguments; typedef void* PD_Arguments;
int PDArgsCreateNone(PD_Arguments* args); PD_API int PDArgsCreateNone(PD_Arguments* args);
int PDArgsDestroy(PD_Arguments args); PD_API int PDArgsDestroy(PD_Arguments args);
int PDArgsGetSize(PD_Arguments args, uint64_t* size); PD_API int PDArgsGetSize(PD_Arguments args, uint64_t* size);
int PDArgsResize(PD_Arguments args, uint64_t size); PD_API int PDArgsResize(PD_Arguments args, uint64_t size);
int PDArgsSetValue(PD_Arguments args, uint64_t ID, PD_Matrix mat); PD_API int PDArgsSetValue(PD_Arguments args, uint64_t ID, PD_Matrix mat);
int PDArgsGetValue(PD_Arguments args, uint64_t ID, PD_Matrix mat); PD_API int PDArgsGetValue(PD_Arguments args, uint64_t ID, PD_Matrix mat);
int PDArgsGetIds(PD_Arguments args, uint64_t ID, PD_IVector ids); PD_API int PDArgsGetIds(PD_Arguments args, uint64_t ID, PD_IVector ids);
/** /**
* @brief GradientMachine means a neural network. * @brief GradientMachine means a neural network.
*/ */
typedef void* PD_GradientMachine; typedef void* PD_GradientMachine;
int PDGradientMachineCreateForPredict(PD_GradientMachine* machine, PD_API int PDGradientMachineCreateForPredict(PD_GradientMachine* machine,
void* modelConfigProtobuf, void* modelConfigProtobuf,
int size); int size);
int PDGradientMachineLoadParameterFromDisk(PD_GradientMachine machine, PD_API int PDGradientMachineLoadParameterFromDisk(PD_GradientMachine machine,
const char* path); const char* path);
int PDGradientMachineForward(PD_GradientMachine machine, PD_API int PDGradientMachineForward(PD_GradientMachine machine,
PD_Arguments inArgs, PD_Arguments inArgs,
PD_Arguments outArgs, PD_Arguments outArgs,
bool isTrain); bool isTrain);
int PDGradientMachineCreateSharedParam(PD_GradientMachine origin, PD_API int PDGradientMachineCreateSharedParam(PD_GradientMachine origin,
void* modelConfigProtobuf, void* modelConfigProtobuf,
int size, int size,
PD_GradientMachine* slave); PD_GradientMachine* slave);
int PDGradientMachineDestroy(PD_GradientMachine machine); PD_API int PDGradientMachineDestroy(PD_GradientMachine machine);
/** /**
* Initialize Paddle. * Initialize Paddle.
*/ */
int PDInit(int argc, char** argv); PD_API int PDInit(int argc, char** argv);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册