Fix makefile cuda

This commit is contained in:
lucasdelimanogueira 2024-04-29 13:39:00 -03:00
parent 35c028dbeb
commit 5d765ed3e0
7 changed files with 5 additions and 3 deletions

View file

@ -3,7 +3,7 @@ CC = g++
NVCC = nvcc
# Compiler flags
CFLAGS = -Wall -Wextra -std=c++11
CFLAGS = -Wall -Wextra -std=c++11 -I/usr/local/cuda/include
NVCCFLAGS = -std=c++11
# Directories
@ -19,7 +19,7 @@ CU_OBJS = $(patsubst $(SRCDIR)/%.cu, $(BUILDDIR)/%.cu.o, $(CU_SRCS))
# CUDA flags and libraries
CUDAFLAGS = -arch=sm_75
CUDALIBS = -L/usr/local/cuda-10.2/lib64/ -lcudart -lcuda
CUDALIBS = -L/usr/local/cuda -lcudart -lcuda
# Rule to build the target
$(TARGET): $(OBJS) $(CU_OBJS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -100,7 +100,8 @@ extern "C" {
tensor->device = device;
}
#else
printf("Warning: CUDA is not available. Cannot perform GPU operations.\n");
fprintf(stderr, "ERROR: CUDA is not available. Cannot perform GPU operations.\n");
exit(0);
#endif
}

View file

@ -206,6 +206,7 @@ class Tensor:
result_data = Tensor()
result_data.tensor = result_tensor_ptr
result_data.shape = self.shape.copy()
result_data.device = self.device
result_data.ndim = 2
return result_data