BobMcDear / neural-network-cuda

Neural network from scratch in CUDA/C++
GNU General Public License v3.0
66 stars 12 forks source link

How to run the code? #1

Closed kk94wang closed 2 years ago

kk94wang commented 2 years ago

This might be a stupid question, but how to compile and run the code? Thank you!

BobMcDear commented 2 years ago

@kk94wang Apologies for the late response.

No, it's by no means a stupid question. Supposing your system has the Nvidia CUDA Compiler (NVCC), compiling a .cu program is done through running nvcc filename.cu dependencies.cu dependencies.cpp. Here, the dependencies refer to external files utilized by filename.cu. For instance, assume you would like to compile test/linear.cu; that program uses CPU/linear.cpp, GPU/linear.cu, and utils/utils.cpp, thus you would command nvcc test/linear.cu CPU/linear.cpp GPU/linear.cu utils/utils.cpp. This creates a.out, which may be executed via ./a.out.

Does that answer your question?

kk94wang commented 2 years ago

@kk94wang Apologies for the late response.

No, it's by no means a stupid question. Supposing your system has the Nvidia CUDA Compiler (NVCC), compiling a .cu program is done through running nvcc filename.cu dependencies.cu dependencies.cpp. Here, the dependencies refer to external files utilized by filename.cu. For instance, assume you would like to compile test/linear.cu; that program uses CPU/linear.cpp, GPU/linear.cu, and utils/utils.cpp, thus you would command nvcc test/linear.cu CPU/linear.cpp GPU/linear.cu utils/utils.cpp. This creates a.out, which may be executed via ./a.out.

Does that answer your question?

Yes, that helps! Thank you very much!