nvidiaref.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. CUDA for Python on Ubuntu 20.04:
  2. Install CUDA on Ubuntu 20.04:
  3. wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
  4. sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
  5. wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb
  6. sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.2-470.57.02-1_amd64.deb
  7. sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
  8. sudo apt-get update
  9. sudo apt-get -y install cuda
  10. Install CUDA toolkit on Ubuntu 20.04:
  11. sudo apt-get install nvidia-cuda-toolkit
  12. And then you'll need to reboot your system again as installing cuda will most
  13. likely bring a different set of drivers for your system.
  14. You can then check CUDA is installed correctly by running
  15. nvcc --version
  16. which produces output similar to the following
  17. nvidia-smi
  18. Being correctly installed doesn't necessarily mean CUDA is correctly linked to
  19. the NVIDIA driver. To make sure this is working, use the bandwidthTest utility
  20. from CUDA's demo_suite folder, usually found in '/usr/local/cuda-11.4/extras/demo_suite/'.
  21. If everything is working correctly, you should see Result = PASS at the end of
  22. the output.
  23. ### sh: 1: cicc: command not found
  24. sudo apt-get install nvidia-cuda-toolkit
  25. (but not required when above steps are followed)
  26. --------------------------------------------------------------------------------
  27. When pycuda installed with pip not recognize the cuda-11.4 toolkit, do the
  28. following to rectify them:
  29. 1. add cuda-11.4 toolkit path in .bashrc
  30. export PATH="$PATH:/usr/local/cuda-11.4/bin/"
  31. export PATH="$PATH:/usr/local/cuda-11.4/lib64:/usr/local/cuda-11.4/lib"
  32. then do,
  33. source .bashrc
  34. 2. sudo find / -name nvcc
  35. if it shows like,
  36. /usr/local/cuda-11.4/bin/nvcc
  37. /usr/bin/nvcc
  38. then remove the /usr/bin/nvcc by the next step and also
  39. apt-get remove nvidia-cuda-toolkit
  40. (which is replaced by installing cuda-11.4 by the instructions above the page)
  41. 3. undo the following link is done before
  42. ln -s /usr/local/cuda-11.4/bin/nvcc /usr/bin/nvcc
  43. and to do that simply
  44. cd /usr/bin
  45. sudo rm nvcc
  46. 4. now pycuda should work properly as desired
  47. Reference:
  48. https://forums.developer.nvidia.com/t/nvcc-preprocessing-failed-compile-error/58422/2
  49. --------------------------------------------------------------------------------
  50. Reference (for installation):
  51. A Complete Introduction to GPU Programming With Practical Examples in CUDA and Python:
  52. https://www.cherryservers.com/blog/introduction-to-gpu-programming-with-cuda-and-python
  53. GPU data processing inside LXD (4. Install the CUDA toolkit)
  54. https://ubuntu.com/tutorials/gpu-data-processing-inside-lxd#4-install-the-cuda-toolkit
  55. Until you run CuPy (v10.1) on Ubuntu 20.04:
  56. https://linuxtut.com/en/8e4f627bca01ffe33321/
  57. CuPy Installation:
  58. https://docs.cupy.dev/en/stable/install.html
  59. Basics of CuPy:
  60. https://docs.cupydev/en/stable/user_guide/basic.html
  61. Tutorials:
  62. Programming GPUs with Python: PyOpenCL and PyCUDA
  63. http://homepages.math.uic.edu/~jan/mcs572f16/mcs572notes/lec29.html#programming-guides
  64. CUDA Training series
  65. https://www.olcf.ornl.gov/cuda-training-series/
  66. Installing CuPy
  67. https://docs.olcf.ornl.gov/software/python/cupy.html
  68. PyCuda 2021.1 documentation
  69. https://documen.tician.de/pycuda/tutorial.html
  70. Python pycuda.driver.memcpy_htod() Examples
  71. https://www.programcreek.com/python/example/107750/pycuda.driver.memcpy_htod
  72. OpenCL Exercises
  73. http://soft.web.ac.be/teaching/multicore/opencl/series1_solutions_DEFHD.html
  74. PyOpenCL: Arrays
  75. https://andreask.cs.illinois.edu/tutorial/dsl-tutorial-materials/dist/03-opencl/1-2-pyopencl-arrays.html
  76. Tutorials
  77. https://streamhpc.com/knowledge/for-developers/tutorials/
  78. OpenCL in Action
  79. https://livebook.manning.com/book/opencl-in-action/table-of-contents/
  80. An Introduction to GPU Programming in Julia
  81. https://nextjournal.com/sdanisch/julia-gpu-programming
  82. JuliaGPU
  83. https://juliagpu.org/
  84. Parallel Computing
  85. https://docs.julialang.org/en/v1/manual/parallel-computing/
  86. HPC WIKI GPU Computing (Julia)
  87. https://hpc-wiki.info/hpc/GPU_Tutorial/Julia#quiz1
  88. Video GPU programming with Julia
  89. https://www.cscs.ch/publications/tutorials/2022/video-of-the-course-gpu-programming-with-julia/
  90. Not a Monad Tutorial
  91. https://www.notamonadtutorial.com/julia-gpu/
  92. Julia versus NumPy arrays
  93. http://kylebarbary.com/blog/julia-vs-numpy-arrays/
  94. Intro 3: Basic Concepts in Julia (Part II)
  95. https://people.engr.ncsu.edu/kay/www501S21/1-Intro/1-Intro-3.html
  96. Kernel Tuner
  97. https://benvanwerkhoven.github.io/kernel_tuner/install.html
  98. # cuda gdb (new in 0.94.1)
  99. $ cuda-gdb --args python -m pycuda.debug program.py