Hi all,
I have a C code (io.c) which compiles and runs perfectly. I am trying to call a function of the C code (io.c) from a cuda file (PCA.cu):
extern "C"{
#include "io.h"
}
#include "cuda.h"
#include "myMethods.h"
int main(int argc, char** argv){
//... everything no related to the function has been commented
here I call to a function which is declared in io.h and implemented in io.c
}
I am using the following Makefile to compile and link io.c and PCA.cu:
MKL =1
CUDA_PATH=/usr/local/cuda-6.0
BUILD_DIR=./build
CUDA_INCLUDE_DIR=-I. -I$(CUDA_PATH)/include
CUDA_LIB_DIR=-L$(CUDA_PATH)/lib64
CUDALIBS=-lcublas -lcudart
utilS= -lpthread -lm
CFLAGS= -Wwrite-strings
CUDAFLAGS= --gpu-architecture sm_20
io.o : io.c
icc $(CFLAGS) -c -O3 io.c -o $(BUILD_DIR)/io.o
PCA.o: PCA.cu
nvcc $(CUDAFLAGS) $(CUDA_INCLUDE_DIR) -c -O3 PCA.cu -o $(BUILD_DIR)/PCA.o
#everything is already compiled, this is just a call to the linker
PCA: io.o PCA.o
icc $(CFLAGS) $(BUILD_DIR)/io.o $(BUILD_DIR)/PCA.o $(CUDA_LIB_DIR) $(utilS) $(CUDALIBS) -o PCA
And I get segmentation fault (core dumped) when I run the generated executable (./PCA)
Any help?
Thanks in advance