SPPU Computer Engineering 2019 Pattern Final Year-Sem 2 Lab Assignments. (If this repo helped you, do star it! :)
Note for Windows Users: Make sure MinGW is installed with pthreads.
Compile: g++ path/to/file/file_name.cpp -fopenmp
Execute: ./a.out
[Linux] or ./a.exe
[Windows]
- Go to Google Collab
- Create a new Notebook(.ipynb file).
- Click on Runtime and change runtime type to GPU.
- Now run
!pip install git+https://github.com/afnan47/cuda.git
in a cell. - On a new cell run
%load_ext nvcc_plugin
- Test the following code
%%cu
#include <iostream>
int main(){
std::cout << "Hello World\n";
return 0;
}
- Remember to add
%%cu
before writing the C++ code for every CUDA program. CUDA is now set.