Skip to content

Commit

Permalink
Merge pull request tensorflow#476 from quantumlib/change-env-var-name
Browse files Browse the repository at this point in the history
Change environment variable name.
  • Loading branch information
sergeisakov authored Nov 9, 2021
2 parents 5db2ee9 + 11f8b12 commit 79c8ab4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(has_nvcc STREQUAL "")
else()
project(qsim LANGUAGES CXX CUDA)
ADD_SUBDIRECTORY(pybind_interface/cuda)
if(DEFINED ENV{CUQUANTUM_ROOT})
if(DEFINED ENV{CUQUANTUM_DIR})
ADD_SUBDIRECTORY(pybind_interface/custatevec)
endif()
endif()
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ CXXFLAGS = -O3 -fopenmp
ARCHFLAGS = -march=native
NVCCFLAGS = -O3

# CUQUANTUM_ROOT should be set.
CUSTATEVECFLAGS = -I$(CUQUANTUM_ROOT)/include -L$(CUQUANTUM_ROOT)/lib64 -lcustatevec -lcublas
# CUQUANTUM_DIR should be set.
CUSTATEVECFLAGS = -I$(CUQUANTUM_DIR)/include -L$(CUQUANTUM_DIR)/lib64 -lcustatevec -lcublas

PYBIND11 = true

Expand Down
4 changes: 2 additions & 2 deletions apps/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ g++ -O3 -march=native -fopenmp -o qsimh_amplitudes.x qsimh_amplitudes.cc
nvcc -O3 -o qsim_base_cuda.x qsim_base_cuda.cu
nvcc -O3 -o qsim_qtrajectory_cuda.x qsim_qtrajectory_cuda.cu

# CUQUANTUM_ROOT should be set.
CUSTATEVECFLAGS="-I${CUQUANTUM_ROOT}/include -L${CUQUANTUM_ROOT}/lib64 -lcustatevec -lcublas"
# CUQUANTUM_DIR should be set.
CUSTATEVECFLAGS="-I${CUQUANTUM_DIR}/include -L${CUQUANTUM_DIR}/lib64 -lcustatevec -lcublas"
nvcc -O3 $CUSTATEVECFLAGS -o qsim_base_custatevec.x qsim_base_custatevec.cu
2 changes: 1 addition & 1 deletion docs/cirq_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ and run on a device with available NVIDIA GPUs.
Compilation for GPU follows the same steps outlined in the
[Compiling qsimcirq](./cirq_interface.md#compiling-qsimcirq) section.
To compile with the NVIDIA cuStateVec library, set the environmment variable
`CUQUANTUM_ROOT` to path to the root of the cuStateVec library.
`CUQUANTUM_DIR` to the path to the cuStateVec library.

`QSimOptions` provides five parameters to configure GPU execution. `use_gpu`
is required to enable GPU execution:
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/gcp_gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ After a moment, you should see a result that looks similar to the following.
[(0.7071067690849304+0j), 0j]
```

### Optional: Use the NVIDIA cuQuantum SDK
### Optional: Use the NVIDIA cuQuantum SDK

If you have the [NVIDIA cuQuantum SDK](https://developer.nvidia.com/cuquantum-sdk)
installed, you can use it with this tutorial. Before building qsim in step 5,
set the `CUQUANTUM_ROOT` environment variable from the command line:
set the `CUQUANTUM_DIR` environment variable from the command line:

```bash
export CUQUANTUM_ROOT=[PATH_TO_CUQUANTUM_SDK]
export CUQUANTUM_DIR=[PATH_TO_CUQUANTUM_SDK]
```

Once you have built qsim, modify the `gpu_options` line like so:
Expand Down
2 changes: 1 addition & 1 deletion pybind_interface/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ifeq ($(shell which $(NVCC)),)
pybind: pybind-cpu decide-cpu
else
# Check for the cuStateVec library.
ifeq ($(CUQUANTUM_ROOT),)
ifeq ($(CUQUANTUM_DIR),)
pybind: pybind-cpu pybind-gpu decide-gpu
else
pybind: pybind-cpu pybind-gpu pybind-custatevec decide-custatevec
Expand Down
4 changes: 2 additions & 2 deletions pybind_interface/custatevec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ find_package(CUDA REQUIRED)

include_directories(${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR}/include)

include_directories($ENV{CUQUANTUM_ROOT}/include)
link_directories($ENV{CUQUANTUM_ROOT}/lib64)
include_directories($ENV{CUQUANTUM_DIR}/include)
link_directories($ENV{CUQUANTUM_DIR}/lib64)

cuda_add_library(qsim_custatevec MODULE pybind_main_custatevec.cpp)
target_link_libraries(qsim_custatevec -lcustatevec -lcublas)
Expand Down
2 changes: 1 addition & 1 deletion pybind_interface/decide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else()

cuda_add_library(qsim_decide MODULE decide.cpp)

if(DEFINED ENV{CUQUANTUM_ROOT})
if(DEFINED ENV{CUQUANTUM_DIR})
target_compile_options(qsim_decide PRIVATE
$<$<COMPILE_LANGUAGE:CUDA>:-D__CUSTATEVEC__>
)
Expand Down
4 changes: 2 additions & 2 deletions tests/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ nvcc -O3 -I$path_to_include -L$path_to_lib -o qtrajectory_cuda_test.x qtrajector
nvcc -O3 -I$path_to_include -L$path_to_lib -o simulator_cuda_test.x simulator_cuda_test.cu -lgtest -lpthread
nvcc -O3 -I$path_to_include -L$path_to_lib -o statespace_cuda_test.x statespace_cuda_test.cu -lgtest -lpthread

# CUQUANTUM_ROOT should be set.
CUSTATEVECFLAGS="-I${CUQUANTUM_ROOT}/include -L${CUQUANTUM_ROOT}/lib64 -lcustatevec -lcublas"
# CUQUANTUM_DIR should be set.
CUSTATEVECFLAGS="-I${CUQUANTUM_DIR}/include -L${CUQUANTUM_DIR}/lib64 -lcustatevec -lcublas"
nvcc -O3 $CUSTATEVECFLAGS -I$path_to_include -L$path_to_lib -o hybrid_custatevec_test.x hybrid_custatevec_test.cu -lgtest -lpthread
nvcc -O3 $CUSTATEVECFLAGS -I$path_to_include -L$path_to_lib -o qtrajectory_custatevec_test.x qtrajectory_custatevec_test.cu -lgtest -lpthread
nvcc -O3 $CUSTATEVECFLAGS -I$path_to_include -L$path_to_lib -o simulator_custatevec_test.x simulator_custatevec_test.cu -lgtest -lpthread
Expand Down

0 comments on commit 79c8ab4

Please sign in to comment.