Skip to content

Commit d747970

Browse files
Merge pull request #596 from jaeyoo/cuda_enabled
Cuda enabled - SimulatorCUDA
2 parents 658cc3b + fe3c823 commit d747970

File tree

13 files changed

+100
-35
lines changed

13 files changed

+100
-35
lines changed

.bazelrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Default build options
2-
build --copt -std=c++11
3-
build --copt -D_GLIBCXX_USE_CXX11_ABI=0
2+
build --copt -std=c++17
3+
build --copt -D_GLIBCXX_USE_CXX11_ABI=1
4+
build --experimental_repo_remote_exec
45

56
##### Sanitizers (choose one, or nosan for none) #####
67

@@ -55,3 +56,7 @@ build:malloc --
5556

5657
# Test flags
5758
test --test_output=errors
59+
60+
# CUDA options
61+
build:cuda --@local_config_cuda//:enable_cuda
62+
build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.3.0

.github/workflows/bazeltest.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
jobs:
12-
# Run tests with Bazel v0.26.
12+
# Run tests with Bazel v5.3.0.
1313
test:
1414
name: Test with Bazel
1515
runs-on: ubuntu-20.04
@@ -26,8 +26,11 @@ jobs:
2626
run: git submodule update --init --recursive
2727
- name: Install Bazel on CI
2828
run: |
29-
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
30-
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
29+
wget https://github.com/bazelbuild/bazel/releases/download/5.3.0/bazel_5.3.0-linux-x86_64.deb
30+
sudo dpkg -i bazel_5.3.0-linux-x86_64.deb
31+
- name: Install requirements
32+
run: |
33+
python3 -m pip install -r requirements.txt
3134
- name: Run C++ tests
3235
run: |
3336
bazel test --config=${{ matrix.hardware_opt }} \
@@ -52,8 +55,11 @@ jobs:
5255
run: git submodule update --init --recursive
5356
- name: Install Bazel on CI
5457
run: |
55-
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
56-
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
58+
wget https://github.com/bazelbuild/bazel/releases/download/5.3.0/bazel_5.3.0-linux-x86_64.deb
59+
sudo dpkg -i bazel_5.3.0-linux-x86_64.deb
60+
- name: Install requirements
61+
run: |
62+
python3 -m pip install -r requirements.txt
5763
- name: Run C++ tests
5864
run: |
5965
bazel test --config=avx --config=openmp \
@@ -69,8 +75,11 @@ jobs:
6975
run: git submodule update --init --recursive
7076
- name: Install Bazel on CI
7177
run: |
72-
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
73-
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
78+
wget https://github.com/bazelbuild/bazel/releases/download/5.3.0/bazel_5.3.0-linux-x86_64.deb
79+
sudo dpkg -i bazel_5.3.0-linux-x86_64.deb
80+
- name: Install requirements
81+
run: |
82+
python3 -m pip install -r requirements.txt
7483
- name: Install google-perftools for tcmalloc
7584
run: sudo apt-get install libgoogle-perftools-dev
7685
- name: Run C++ tests

.github/workflows/release_wheels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: Install cibuildwheel and twine
5050
run: python -m pip install cibuildwheel==2.2.2
5151

52+
- name: Install requirements
53+
run: python -m pip install -r requirements.txt
54+
5255
- name: Run C++ tests
5356
run: bash build_tools/test_libs.sh
5457

.github/workflows/testing_wheels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
- name: Install cibuildwheel and twine
5555
run: python -m pip install cibuildwheel==2.2.2
5656

57+
- name: Install requirements
58+
run: python -m pip install -r requirements.txt
59+
5760
- name: Run C++ tests
5861
run: bash build_tools/test_libs.sh
5962

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ bazel-*
2020

2121
# Eigen library
2222
eigen
23+
24+
# vscode
25+
.vscode/*
26+
27+
# Bazel files
28+
/bazel-*

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
EIGEN_PREFIX = "d10b27fe37736d2944630ecd7557cefa95cf87c9"
1+
EIGEN_PREFIX = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
22
EIGEN_URL = "https://gitlab.com/libeigen/eigen/-/archive/"
33

44
TARGETS = qsim

WORKSPACE

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,32 @@ http_archive(
2020
# https://github.com/tensorflow/quantum
2121
http_archive(
2222
name = "org_tensorflow",
23-
sha256 = "e82f3b94d863e223881678406faa5071b895e1ff928ba18578d2adbbc6b42a4c",
24-
strip_prefix = "tensorflow-2.1.0",
23+
sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
24+
strip_prefix = "tensorflow-2.11.0",
2525
urls = [
26-
"https://github.com/tensorflow/tensorflow/archive/v2.1.0.zip",
26+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.zip",
2727
],
2828
)
2929

30+
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
3031

31-
EIGEN_COMMIT = "12e8d57108c50d8a63605c6eb0144c838c128337"
32-
EIGEN_SHA256 = "f689246e342c3955af48d26ce74ac34d21b579a00675c341721a735937919b02"
32+
workspace()
33+
34+
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
35+
36+
workspace()
37+
38+
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
39+
40+
workspace()
41+
42+
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
43+
44+
workspace()
45+
46+
47+
EIGEN_COMMIT = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
48+
EIGEN_SHA256 = "eca9847b3fe6249e0234a342b78f73feec07d29f534e914ba5f920f3e09383a3"
3349

3450

3551
http_archive(

build_tools/test_libs.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
set e # Ignore errors until artifacts are collected.
2020
EXIT_CODE=0
2121
for TARGET in bitstring_test channels_cirq_test circuit_qsim_parser_test expect_test \
22-
fuser_basic_test gates_qsim_test hybrid_test matrix_test qtrajectory_test \
22+
fuser_basic_test gates_qsim_test hybrid_avx_test matrix_test qtrajectory_avx_test \
2323
run_qsim_test run_qsimh_test simulator_basic_test simulator_sse_test statespace_basic_test \
2424
statespace_sse_test unitary_calculator_basic_test unitary_calculator_sse_test \
2525
unitaryspace_basic_test unitaryspace_sse_test vectorspace_test; do \

lib/BUILD

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
package(default_visibility = ["//visibility:public"])
1+
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_library")
22

3-
# Libraries of the following form:
4-
# # cuda_library
5-
# cc_library(...)
6-
# are converted to cuda_library rules when imported to the Google codebase.
7-
# Do not modify this tag.
3+
package(default_visibility = ["//visibility:public"])
84

95
##### Aggregate libraries #####
106

@@ -67,8 +63,7 @@ cc_library(
6763
)
6864

6965
# Full qsim library, including CUDA
70-
# cuda_library
71-
cc_library(
66+
cuda_library(
7267
name = "qsim_cuda_lib",
7368
hdrs = [
7469
"bits.h",
@@ -99,6 +94,7 @@ cc_library(
9994
"run_qsimh.h",
10095
"seqfor.h",
10196
"simmux.h",
97+
"simmux_gpu.h",
10298
"simulator.h",
10399
"simulator_avx.h",
104100
"simulator_avx512.h",
@@ -247,8 +243,7 @@ cc_library(
247243
hdrs = ["util_cpu.h"],
248244
)
249245

250-
# cuda_library
251-
cc_library(
246+
cuda_library(
252247
name = "util_cuda",
253248
hdrs = ["util_cuda.h"],
254249
)
@@ -408,8 +403,7 @@ cc_library(
408403
hdrs = ["vectorspace.h"],
409404
)
410405

411-
# cuda_library
412-
cc_library(
406+
cuda_library(
413407
name = "vectorspace_cuda",
414408
hdrs = ["vectorspace_cuda.h"],
415409
)
@@ -462,8 +456,7 @@ cc_library(
462456
],
463457
)
464458

465-
# cuda_library
466-
cc_library(
459+
cuda_library(
467460
name = "statespace_cuda",
468461
hdrs = [
469462
"statespace_cuda.h",
@@ -520,8 +513,7 @@ cc_library(
520513
],
521514
)
522515

523-
# cuda_library
524-
cc_library(
516+
cuda_library(
525517
name = "simulator_cuda",
526518
hdrs = [
527519
"simulator_cuda.h",

0 commit comments

Comments
 (0)