From ac7c695566f3719c708d8f9619021cb08ade5cc5 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 08:30:26 +0900 Subject: [PATCH 01/23] add travis yml --- .travis.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9b0159c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,55 @@ +language: cpp + +sudo: enabled + +compiler: + - gcc + +matrix: + include: + - name: CUDA 8 + env: + - CUDA=8.0.61-1 + - CUDA_SHORT=8.0 + - UBUNTU_VERSION=ubuntu1604 + dist: xenial + - name: CUDA 9 + env: + - CUDA=9.2.148-1 + - CUDA_SHORT=9.2 + - UBUNTU_VERSION=ubuntu1604 + dist: xenial + - name: CUDA 10 + env: + - CUDA=10.1.105-1 + - CUDA_SHORT=10.1 + - UBUNTU_VERSION=ubuntu1804 + dist: bionic + +addons: + apt: + packages: + - cmake + - python3 + - python3-pip + - python3-setuptools + +before_install: + - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb + - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} + - sudo dpkg -i ${INSTALLER} + - wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub + - sudo apt-key add 7fa2af80.pub + - sudo apt update -qq + - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} + - sudo apt clean + - CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} + - LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + - PATH=${CUDA_HOME}/bin:${PATH} + - wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip + - unzip ninja-linux.zip + - PATH=${PATH}:${PWD} + - pip install -U pip + +- script: + - python setup.py install From a15b7c5df2c4429e5b39351a472f65354f80e10b Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 08:35:47 +0900 Subject: [PATCH 02/23] chwd --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b0159c..c589c94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,8 +48,8 @@ before_install: - PATH=${CUDA_HOME}/bin:${PATH} - wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip - unzip ninja-linux.zip - - PATH=${PATH}:${PWD} - pip install -U pip + - PATH=${PATH}:${PWD} - script: - python setup.py install From cd1744126b12cc863f2615dfe440fdb640094845 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 08:48:10 +0900 Subject: [PATCH 03/23] validate yaml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c589c94..f696962 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,5 +51,5 @@ before_install: - pip install -U pip - PATH=${PATH}:${PWD} -- script: +script: - python setup.py install From ead0214b1fb936275d89235da782bb045e83baa5 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 08:50:34 +0900 Subject: [PATCH 04/23] add badge --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2da24b3..4f0b054 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# CUSIM + +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) + ### Introduction This project is to speed up various ML models (e.g. topic modeling, word embedding, etc) by CUDA. It would be nice to think of it as [gensim](https://github.com/RaRe-Technologies/gensim)'s GPU version project. As a starting step, I implemented the most widely used word embedding model, the [word2vec](https://arxiv.org/pdf/1301.3781.pdf) model, and the most representative topic model, the [LDA (Latent Dirichlet Allocation)](https://www.jmlr.org/papers/volume3/blei03a/blei03a.pdf) model. From 238a39ddc1a8bc7dcfd299838dea2e2b135724e1 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 08:59:28 +0900 Subject: [PATCH 05/23] ensure python ver --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f696962..9051cf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,8 @@ matrix: addons: apt: packages: - - cmake - - python3 + - python3.6 - python3-pip - - python3-setuptools before_install: - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb @@ -52,4 +50,4 @@ before_install: - PATH=${PATH}:${PWD} script: - - python setup.py install + - python3.6 setup.py install From 300858c3291f46517cf573f57ef5552d31f4f766 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:03:17 +0900 Subject: [PATCH 06/23] sudo apt update --- .travis.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9051cf3..76f9494 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,13 +26,12 @@ matrix: - UBUNTU_VERSION=ubuntu1804 dist: bionic -addons: - apt: - packages: - - python3.6 - - python3-pip - before_install: + - sudo apt update + - sudo apt install -y software-properties-common + - sudo add-apt-repository -y ppa:deadsnakes/ppa + - sudo apt update + - sudo apt install -y python3-pip python3.6 - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} - sudo dpkg -i ${INSTALLER} @@ -46,7 +45,6 @@ before_install: - PATH=${CUDA_HOME}/bin:${PATH} - wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip - unzip ninja-linux.zip - - pip install -U pip - PATH=${PATH}:${PWD} script: From c66348862d57a0cebae9dfbc7972fcb4f7d2ce80 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:06:15 +0900 Subject: [PATCH 07/23] install requirements.txt --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 76f9494..9913881 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,8 @@ before_install: - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt update - sudo apt install -y python3-pip python3.6 + - pip install -U pip + - pip install -r requirements.txt - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} - sudo dpkg -i ${INSTALLER} From 5d1fdb2e0a856ffa356870708e7ae1cd0083162b Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:11:48 +0900 Subject: [PATCH 08/23] update pip verion --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9913881..5419184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,9 @@ before_install: - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt update - sudo apt install -y python3-pip python3.6 - - pip install -U pip - - pip install -r requirements.txt + - pip3.6 install -U pip + - pip3.6 install -r requirements.txt + - python3.6 -m grpc_tools.protoc --python_out cusim/ --proto_path cusim/proto/ config.proto - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} - sudo dpkg -i ${INSTALLER} From 6e3600cc9bab2366989ae811e3efa80873aa854d Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:12:59 +0900 Subject: [PATCH 09/23] change path before generating proto --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5419184..31f2e23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,6 @@ before_install: - sudo apt install -y python3-pip python3.6 - pip3.6 install -U pip - pip3.6 install -r requirements.txt - - python3.6 -m grpc_tools.protoc --python_out cusim/ --proto_path cusim/proto/ config.proto - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} - sudo dpkg -i ${INSTALLER} @@ -49,6 +48,7 @@ before_install: - wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip - unzip ninja-linux.zip - PATH=${PATH}:${PWD} + - python3.6 -m grpc_tools.protoc --python_out cusim/ --proto_path cusim/proto/ config.proto script: - python3.6 setup.py install From 169cd57ada887de910f7139c8428b32bfd8aebe6 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:17:36 +0900 Subject: [PATCH 10/23] pip3.6 => pip3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31f2e23..b59051b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ before_install: - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt update - sudo apt install -y python3-pip python3.6 - - pip3.6 install -U pip - - pip3.6 install -r requirements.txt + - pip3 install -U pip + - pip3 install -r requirements.txt - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} - sudo dpkg -i ${INSTALLER} From 5f104fdcedc4f05bea56b1f724fee1503bf2af17 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:23:41 +0900 Subject: [PATCH 11/23] no xenial --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b59051b..b762aa6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ matrix: env: - CUDA=8.0.61-1 - CUDA_SHORT=8.0 - - UBUNTU_VERSION=ubuntu1604 - dist: xenial + - UBUNTU_VERSION=ubuntu1804 + dist: bionic - name: CUDA 9 env: - CUDA=9.2.148-1 - CUDA_SHORT=9.2 - - UBUNTU_VERSION=ubuntu1604 - dist: xenial + - UBUNTU_VERSION=ubuntu1804 + dist: bionic - name: CUDA 10 env: - CUDA=10.1.105-1 From 0ef1795c69c299e4d7f486d98d9deeb2b77210b7 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:27:39 +0900 Subject: [PATCH 12/23] install setuptools --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b762aa6..8d37f2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ before_install: - sudo apt update - sudo apt install -y python3-pip python3.6 - pip3 install -U pip + - pip3 install setuptools - pip3 install -r requirements.txt - INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb - wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} From b2429e7bfeed41717cbc9455337f410c0be82702 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:32:41 +0900 Subject: [PATCH 13/23] use sudo --- .travis.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d37f2f..702ed91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,18 +7,6 @@ compiler: matrix: include: - - name: CUDA 8 - env: - - CUDA=8.0.61-1 - - CUDA_SHORT=8.0 - - UBUNTU_VERSION=ubuntu1804 - dist: bionic - - name: CUDA 9 - env: - - CUDA=9.2.148-1 - - CUDA_SHORT=9.2 - - UBUNTU_VERSION=ubuntu1804 - dist: bionic - name: CUDA 10 env: - CUDA=10.1.105-1 @@ -52,4 +40,4 @@ before_install: - python3.6 -m grpc_tools.protoc --python_out cusim/ --proto_path cusim/proto/ config.proto script: - - python3.6 setup.py install + - sudo python3.6 setup.py install From 186b75179c4251fe4599cf0bb9ac39fac6180ff4 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 09:38:21 +0900 Subject: [PATCH 14/23] export cuda home --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 702ed91..7456ae6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,12 +31,9 @@ before_install: - sudo apt update -qq - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} - sudo apt clean - - CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} - - LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} - - PATH=${CUDA_HOME}/bin:${PATH} - - wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip - - unzip ninja-linux.zip - - PATH=${PATH}:${PWD} + - export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} + - export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + - export PATH=${CUDA_HOME}/bin:${PATH} - python3.6 -m grpc_tools.protoc --python_out cusim/ --proto_path cusim/proto/ config.proto script: From 61a7174b68b87a39400bbeb3d283752289d67c9d Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:20:12 +0900 Subject: [PATCH 15/23] check cuda ver --- cuda_setup.py | 84 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/cuda_setup.py b/cuda_setup.py index 5ff76b6..43f8c74 100644 --- a/cuda_setup.py +++ b/cuda_setup.py @@ -28,6 +28,60 @@ def find_in_path(name, path): return None +def get_cuda_sm_list(cuda_ver): + if "CUDA_SM_LIST" in os.environ: + sm_list = os.environ["CUDA_SM_LIST"].split(",") + else: + sm_list = ["30", "52", "60", "61", "70", "75", "80", "86"] + if cuda_ver >= 110: + filter_list = ["30"] + if cuda_ver == 110: + filter_list += ["86"] + else: + filter_list = ["80", "86"] + if cuda_ver < 100: + filter_list += ["75"] + if cuda_ver < 90: + filter_list += ["70"] + if cuda_ver < 80: + filter_list += ["60", "61"] + sm_list = [sm for sm in sm_list if sm not in filter_list] + return sm_list + + +def get_cuda_compute(cuda_ver): + if "CUDA_COMPUTE" in os.environ: + compute = os.environ["CUDA_COMPUTE"] + else: + if 70 <= cuda_ver < 80: + compute = "52" + if 80 <= cuda_ver < 90: + compute = "61" + if 90 <= cuda_ver < 100: + compute = "70" + if 100 <= cuda_ver < 110: + compute = "75" + if cuda_ver == 110: + compute = "80" + if cuda_ver == 111: + compute = "86" + return compute + + +def get_cuda_arch(cuda_ver): + if "CUDA_ARCH" in os.environ: + arch = os.environ["CUDA_ARCH"] + else: + if 70 <= cuda_ver < 92: + arch = "30" + if 92 <= cuda_ver < 110: + arch = "50" + if cuda_ver == 110: + arch = "52" + if cuda_ver == "111": + arch = "80" + return arch + def locate_cuda(): """Locate the CUDA environment on the system If a valid cuda installation is found @@ -60,22 +114,22 @@ def locate_cuda(): 'your path, or set $CUDA_HOME to enable CUDA extensions') return None home = os.path.dirname(os.path.dirname(nvcc)) - cudaconfig = {'home': home, - 'nvcc': nvcc, - 'include': os.path.join(home, 'include'), - 'lib64': os.path.join(home, 'lib64')} - post_args = [ - "-arch=sm_52", - "-gencode=arch=compute_52,code=sm_52", - "-gencode=arch=compute_60,code=sm_60", - "-gencode=arch=compute_61,code=sm_61", - "-gencode=arch=compute_70,code=sm_70", - "-gencode=arch=compute_75,code=sm_75", - "-gencode=arch=compute_80,code=sm_80", - "-gencode=arch=compute_86,code=sm_86", - "-gencode=arch=compute_86,code=compute_86", - '--ptxas-options=-v', '-O2'] + 'nvcc': nvcc, + 'include': os.path.join(home, 'include'), + 'lib64': os.path.join(home, 'lib64')} + cuda_ver = os.path.basename(os.path.realpath(home)).split("-")[1].split(".") + cuda_ver = 10 * int(cuda_ver[0]) + int(cuda_ver[1]) + assert cuda_ver >= 700, f"too low cuda ver {cuda_ver}" + logging.info("cuda_ver: %s", cuda_ver) + arch = get_cuda_arch(cuda_ver) + sm_list = get_cuda_sm_list(cuda_ver) + compute = get_cuda_compute(cuda_ver) + post_args = [f"-arch=sm_{arch}"] + \ + [f"-gencode=arch=compute_{sm},code=sm_{sm}" for sm in sm_list] + \ + [f"-gencode=arch=compute_{compute},code=compute_{compute}", + "-ptxas-options=-v", "-O2"] + logging.info("nvcc post args: %s", post_args) if HALF_PRECISION: post_args = [flag for flag in post_args if "52" not in flag] From 8430e8e76d115c42c17ea02c36fd56e35f11a021 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:21:53 +0900 Subject: [PATCH 16/23] bug-fix --- cuda_setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_setup.py b/cuda_setup.py index 43f8c74..fd6c549 100644 --- a/cuda_setup.py +++ b/cuda_setup.py @@ -78,7 +78,7 @@ def get_cuda_arch(cuda_ver): arch = "50" if cuda_ver == 110: arch = "52" - if cuda_ver == "111": + if cuda_ver == 111: arch = "80" return arch @@ -120,7 +120,7 @@ def locate_cuda(): 'lib64': os.path.join(home, 'lib64')} cuda_ver = os.path.basename(os.path.realpath(home)).split("-")[1].split(".") cuda_ver = 10 * int(cuda_ver[0]) + int(cuda_ver[1]) - assert cuda_ver >= 700, f"too low cuda ver {cuda_ver}" + assert cuda_ver >= 70, f"too low cuda ver {cuda_ver}" logging.info("cuda_ver: %s", cuda_ver) arch = get_cuda_arch(cuda_ver) sm_list = get_cuda_sm_list(cuda_ver) From e4db3d94a639ef87686fb269915e36e9aa519224 Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:25:50 +0900 Subject: [PATCH 17/23] fix assertion logging --- cuda_setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cuda_setup.py b/cuda_setup.py index fd6c549..74cc5d3 100644 --- a/cuda_setup.py +++ b/cuda_setup.py @@ -119,9 +119,10 @@ def locate_cuda(): 'include': os.path.join(home, 'include'), 'lib64': os.path.join(home, 'lib64')} cuda_ver = os.path.basename(os.path.realpath(home)).split("-")[1].split(".") - cuda_ver = 10 * int(cuda_ver[0]) + int(cuda_ver[1]) - assert cuda_ver >= 70, f"too low cuda ver {cuda_ver}" - logging.info("cuda_ver: %s", cuda_ver) + major, minor = int(cuda_ver[0]), int(cuda_ver[1]) + cuda_ver = 10 * major + minor + assert cuda_ver >= 70, f"too low cuda ver {major}.{minor}" + print(f"cuda_ver: {major}.{minor}") arch = get_cuda_arch(cuda_ver) sm_list = get_cuda_sm_list(cuda_ver) compute = get_cuda_compute(cuda_ver) @@ -129,7 +130,7 @@ def locate_cuda(): [f"-gencode=arch=compute_{sm},code=sm_{sm}" for sm in sm_list] + \ [f"-gencode=arch=compute_{compute},code=compute_{compute}", "-ptxas-options=-v", "-O2"] - logging.info("nvcc post args: %s", post_args) + print(f"nvcc post args: {post_args}") if HALF_PRECISION: post_args = [flag for flag in post_args if "52" not in flag] From cd9f0feb50c92b0a14d9559ef85339e44dd8e6cf Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:27:58 +0900 Subject: [PATCH 18/23] fix typo --- cuda_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_setup.py b/cuda_setup.py index 74cc5d3..5e8b342 100644 --- a/cuda_setup.py +++ b/cuda_setup.py @@ -129,7 +129,7 @@ def locate_cuda(): post_args = [f"-arch=sm_{arch}"] + \ [f"-gencode=arch=compute_{sm},code=sm_{sm}" for sm in sm_list] + \ [f"-gencode=arch=compute_{compute},code=compute_{compute}", - "-ptxas-options=-v", "-O2"] + "--ptxas-options=-v", "-O2"] print(f"nvcc post args: {post_args}") if HALF_PRECISION: post_args = [flag for flag in post_args if "52" not in flag] From 7422a84451c238101d58167a0f3720f27aa9790f Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:41:12 +0900 Subject: [PATCH 19/23] install all cuda --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7456ae6..4abe2c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub - sudo apt-key add 7fa2af80.pub - sudo apt update -qq - - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} + - sudo apt install -y cuda - sudo apt clean - export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} - export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} From acdc3b3fcce42fc3bd010945165fb40a231f95cc Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 10:45:35 +0900 Subject: [PATCH 20/23] install specific cuda ver --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4abe2c0..11a8558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub - sudo apt-key add 7fa2af80.pub - sudo apt update -qq - - sudo apt install -y cuda + - sudo apt install -y cuda-${CUDA_SHORT/./-} - sudo apt clean - export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} - export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} From b54902ba2e13fbc8d6c7967e2458daa4d827335f Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 11:16:44 +0900 Subject: [PATCH 21/23] exclude cublas --- .travis.yml | 2 +- cpp/include/utils/cuda_utils_kernels.cuh | 48 ++++++++++++------------ setup.py | 4 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11a8558..e7f700c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub - sudo apt-key add 7fa2af80.pub - sudo apt update -qq - - sudo apt install -y cuda-${CUDA_SHORT/./-} + - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} - sudo apt clean - export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} - export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} diff --git a/cpp/include/utils/cuda_utils_kernels.cuh b/cpp/include/utils/cuda_utils_kernels.cuh index 47d447e..fa9b0aa 100644 --- a/cpp/include/utils/cuda_utils_kernels.cuh +++ b/cpp/include/utils/cuda_utils_kernels.cuh @@ -5,7 +5,7 @@ // LICENSE file in the root directory of this source tree. #pragma once #include -#include +// #include #include #include @@ -39,29 +39,29 @@ inline void checkCuda(cudaError_t code, const char *file, int line) { } } -inline const char* cublasGetErrorString(cublasStatus_t status) { - switch (status) { - case CUBLAS_STATUS_SUCCESS: return "CUBLAS_STATUS_SUCCESS"; - case CUBLAS_STATUS_NOT_INITIALIZED: return "CUBLAS_STATUS_NOT_INITIALIZED"; - case CUBLAS_STATUS_ALLOC_FAILED: return "CUBLAS_STATUS_ALLOC_FAILED"; - case CUBLAS_STATUS_INVALID_VALUE: return "CUBLAS_STATUS_INVALID_VALUE"; - case CUBLAS_STATUS_ARCH_MISMATCH: return "CUBLAS_STATUS_ARCH_MISMATCH"; - case CUBLAS_STATUS_MAPPING_ERROR: return "CUBLAS_STATUS_MAPPING_ERROR"; - case CUBLAS_STATUS_EXECUTION_FAILED: return "CUBLAS_STATUS_EXECUTION_FAILED"; - case CUBLAS_STATUS_INTERNAL_ERROR: return "CUBLAS_STATUS_INTERNAL_ERROR"; - } - return "Unknown"; -} - -#define CHECK_CUBLAS(code) { checkCublas((code), __FILE__, __LINE__); } -inline void checkCublas(cublasStatus_t code, const char * file, int line) { - if (code != CUBLAS_STATUS_SUCCESS) { - std::stringstream err; - err << "cublas error: " << cublasGetErrorString(code) - << " (" << file << ":" << line << ")"; - throw std::runtime_error(err.str()); - } -} +// inline const char* cublasGetErrorString(cublasStatus_t status) { +// switch (status) { +// case CUBLAS_STATUS_SUCCESS: return "CUBLAS_STATUS_SUCCESS"; +// case CUBLAS_STATUS_NOT_INITIALIZED: return "CUBLAS_STATUS_NOT_INITIALIZED"; +// case CUBLAS_STATUS_ALLOC_FAILED: return "CUBLAS_STATUS_ALLOC_FAILED"; +// case CUBLAS_STATUS_INVALID_VALUE: return "CUBLAS_STATUS_INVALID_VALUE"; +// case CUBLAS_STATUS_ARCH_MISMATCH: return "CUBLAS_STATUS_ARCH_MISMATCH"; +// case CUBLAS_STATUS_MAPPING_ERROR: return "CUBLAS_STATUS_MAPPING_ERROR"; +// case CUBLAS_STATUS_EXECUTION_FAILED: return "CUBLAS_STATUS_EXECUTION_FAILED"; +// case CUBLAS_STATUS_INTERNAL_ERROR: return "CUBLAS_STATUS_INTERNAL_ERROR"; +// } +// return "Unknown"; +// } +// +// #define CHECK_CUBLAS(code) { checkCublas((code), __FILE__, __LINE__); } +// inline void checkCublas(cublasStatus_t code, const char * file, int line) { +// if (code != CUBLAS_STATUS_SUCCESS) { +// std::stringstream err; +// err << "cublas error: " << cublasGetErrorString(code) +// << " (" << file << ":" << line << ")"; +// throw std::runtime_error(err.str()); +// } +// } inline DeviceInfo GetDeviceInfo() { DeviceInfo ret; diff --git a/setup.py b/setup.py index d52d007..18144ac 100644 --- a/setup.py +++ b/setup.py @@ -92,7 +92,7 @@ def __init__(self, name): extra_compile_args=extra_compile_args, extra_link_args=["-fopenmp"], library_dirs=[CUDA['lib64']], - libraries=['cudart', 'cublas', 'curand'], + libraries=['cudart', 'curand'], extra_objects=[], include_dirs=[ \ "cpp/include/", np.get_include(), pybind11.get_include(), @@ -107,7 +107,7 @@ def __init__(self, name): extra_compile_args=extra_compile_args, extra_link_args=["-fopenmp"], library_dirs=[CUDA['lib64']], - libraries=['cudart', 'cublas', 'curand'], + libraries=['cudart', 'curand'], extra_objects=[], include_dirs=[ \ "cpp/include/", np.get_include(), pybind11.get_include(), From 1b655316d8e70778b5c27635db10e0f32a43c29b Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 11:23:42 +0900 Subject: [PATCH 22/23] install g+ --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e7f700c..20f7ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_install: - sudo apt install -y software-properties-common - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt update - - sudo apt install -y python3-pip python3.6 + - sudo apt install -y python3-pip python3.6 g++ - pip3 install -U pip - pip3 install setuptools - pip3 install -r requirements.txt From d45fd30a1b844cfe1b63bacd3839e702bb7c62fb Mon Sep 17 00:00:00 2001 From: js1010 Date: Sat, 20 Feb 2021 11:30:52 +0900 Subject: [PATCH 23/23] install curand --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 20f7ebb..1fd59fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub - sudo apt-key add 7fa2af80.pub - sudo apt update -qq - - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} + - sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-curand-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} - sudo apt clean - export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} - export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}