chundoong-lab-ta/APSS23/compile_and_linking/compile.sh

18 lines
328 B
Bash
Raw Normal View History

2023-08-09 15:11:42 +09:00
#!/bin/bash
# CUDA installation directory
CUDA_ROOT=/usr/local/cuda
# CUDA Compiler (nvcc)
CUX=${CUDA_ROOT}/bin/nvcc
# Compile file1.cpp
g++ -c -I${CUDA_ROOT}/include -o file1.o file1.cpp
# Compile file2.cu
${CUX} -c -o file2.o file2.cu
# Link file1.o and file2.o
g++ -o main file1.o file2.o -L${CUDA_ROOT}/lib64 -lcudart