NVIDIA / NVIDIA/cuda-quantum

The quick start installation guide does not work for zsh (and likely other shells)

Open
#2,194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale-notified
Dominant language
C++
Stars
1.1k
Forks
456
Avg merge
1d 22h
Merged PRs (30d)
165

Description

Required prerequisites
  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug

The quick start installation guide says to install and use cuda-quantum like so:

sudo -E bash install_cuda_quantum.$(uname -m) --accept
. /etc/profile

This can cause issues if you are not using bash, as once install_cuda_quantum.$(uname -m) finishes running, you are returned to the calling shell. In my case, I am using zsh. The issues occurs because /opt/nvidia/cudaq/set_env.sh uses ${BASH_SOURCE[0]} which doesn't work well when using zsh.

Steps to reproduce the bug

Run a shell other than bash (such as zsh) and then attempt to source the environment file.

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ cat /etc/profile | tail -n 2
CUDAQ_INSTALL_PATH="/opt/nvidia/cudaq"
. "${CUDAQ_INSTALL_PATH}/set_env.sh"
$ . /etc/profile
$ echo $PATH
./bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Expected behavior
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ cat /etc/profile | tail -n 2
CUDAQ_INSTALL_PATH="/opt/nvidia/cudaq"
. "${CUDAQ_INSTALL_PATH}/set_env.sh"
$ . /etc/profile
$ echo $PATH
/opt/nvidia/cudaq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment
  • CUDA Quantum version: any
  • Python version: any
  • C++ compiler: any
  • Operating system: Ubuntu 22.04
Suggestions

For me, I fixed it by instead using

export CUDA_QUANTUM_PATH=`dirname "$(readlink -f "$0")"`

in my /opt/nvidia/cudaq/set_env.sh

Which works well for zsh, but not for bash.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the quick_start.html installation instructions and inspect /opt/nvidia/cudaq/set_env.sh, /etc/profile, and the generated install_cuda_quantum.$(uname -m) setup on Ubuntu 22.04. Reproduce sourcing the environment from zsh and bash, then verify that CUDA-Q's bin directory is added correctly without breaking either shell.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell, zsh
Domain
devops, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.