Skip to content

Instantly share code, notes, and snippets.

@Ending2015a
Last active April 25, 2024 16:25
Show Gist options
  • Select an option

  • Save Ending2015a/88169ffb078075b93b84c65558f4e1a2 to your computer and use it in GitHub Desktop.

Select an option

Save Ending2015a/88169ffb078075b93b84c65558f4e1a2 to your computer and use it in GitHub Desktop.

Revisions

  1. Ending2015a revised this gist Oct 5, 2018. No changes.
  2. Ending2015a renamed this gist Oct 5, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. Ending2015a created this gist Oct 5, 2018.
    28 changes: 28 additions & 0 deletions cuda10_colab.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@

    # install cuda 10.0
    !apt-get update;
    !wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
    !dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
    !apt-key add /var/cuda-repo-10-0-local/7fa2af80.pub
    !apt-get update
    !apt-get -y install gcc-7 g++-7
    !apt-get -y install cuda

    !export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
    !export LD_LIBRARY_PATH=/usr/local/cuda/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

    # check if installed successfully
    !/usr/local/cuda/bin/nvcc --version

    # install python-nvcc plugin
    !pip install git+git://github.com/andreinechaev/nvcc4jupyter.git
    %load_ext nvcc_plugin


    # you can start writing your cuda code
    %%cu
    #include <iostream>
    int main(){
    std::cout << "hello" << std::endl;
    return 0;
    }