I am sorry to ask this question again which is similar as the question as I asked before 5666. But I still do not know how to deal with it, I hope anyone who can help me, thank you advance !!!
My Question: How can I do the similar thing as example in apaszke’s blog in pytorch:
#include "TH/TH.h"
int main()
{
THFile *x_file = THDiskFile_new("x", "r", 0);
THFile *y_file = THDiskFile_new("y", "r", 0);
THFloatTensor *x = THFloatTensor_newWithSize1d(10);
THFloatTensor *y = THFloatTensor_newWithSize1d(10);
THFile_readFloat(x_file, x->storage);
THFile_readFloat(y_file, y->storage);
double result = THFloatTensor_dot(x, y) + THFloatTensor_sumall(x);
printf("%f\n", result);
THFloatTensor_free(x);
THFloatTensor_free(y);
THFile_free(x_file);
THFile_free(y_file);
return 0;
}
My cmake is as follows (this is a subdirectory):
file(GLOB hfile *.hpp *.h )
file(GLOB cufile *.cu)
set(exec main.cpp)
set(TORCH_LIB "My_Root_To_Anaconda/python3.5/site-packages/torch/lib")
message(${TORCH_LIB})
include_directories(${TORCH_LIB}/include)
add_executable(abs ${exec} ${hfile} ${cufile})
file(GLOB sofile ${TORCH_LIB}/*.so.*)
target_link_libraries(abs ${sofile})
However, when I #include "TH/TH.h"
,there is the error as follows(I change the chinese to english):
torch/lib/libTH.so.1:undefined ‘dpstrf_’
torch/lib/libTH.so.1:undefined ‘GOMP_parallel_start@VERSION’
.... and many other undefined
Additional: When I make ATen, and include .so file from that, it will not such error.