addition.ipynb - Colab
addition.ipynb - Colab
2)
!apt-get update
!apt-get install -y cuda-toolkit-11-2
!nvcc --version
!nvidia-smi
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
%%writefile add.cu
#include <iostream>
#include <cuda_runtime.h>
int main() {
int n;
std::cout << "Enter the number of elements: ";
std::cin >> n;
cudaFree(dev_A);
cudaFree(dev_B);
cudaFree(dev_C);
delete[] A;
delete[] B;
delete[] C;
return 0;
}
Writing add.cu
!./add
58