Skip to content

Instantly share code, notes, and snippets.

@hariby
Last active September 10, 2025 09:57
Show Gist options
  • Select an option

  • Save hariby/47c2a32755969f4fb3c6235d718390a7 to your computer and use it in GitHub Desktop.

Select an option

Save hariby/47c2a32755969f4fb3c6235d718390a7 to your computer and use it in GitHub Desktop.
CUDA-Q on Amazon Braket (Workshop Studio)

GPU インスタンス

  1. Workshop Studio で起動している既存の Amazon Braket (Amazon SageMaker AI) Notebook ml.t3.2xlarge を停止 (Stop) する。
  2. Amazon SageMaker AI サービスの画面で、インスタンスタイプを ml.p3.2xlarge に変更する。https://us-east-1.console.aws.amazon.com/sagemaker/home?region=us-east-1#/notebook-instances
  3. その Notebook インスタンスを起動 (Start) する。
  4. Jupyter の kernel config vi ~/.local/share/jupyter/kernels/docker_cudaq/kernel.json に3行追記。 https://gist.github.com/hariby/47c2a32755969f4fb3c6235d718390a7#file-kernel-json-L8-L10

Notebook

  • cudaq_target.ipynb
    • n = 26 まで for n in range(10, 27):

optional

sudo vi /etc/docker/daemon.json で以下の default-runtime を追記して、

,
    "default-runtime": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    }

ビルド ./custom-install-script.sh ws-event-55c13874-08f-us-east-1 1a98a208-4616-4f90-bed0-4735061132c5

CUDA-Q on Braket

https://github.com/amazon-braket/amazon-braket-examples/tree/main/examples/nvidia_cuda_q

Container image

(amazon-braket/amazon-braket-examples#738 で修正済み)

  • ECR image name に prefix (amazon-braket-) つける
  • リージョンを us-east-1 に変える !container/container_build_and_push.sh amazon-braket-cudaq-job us-east-1

QPU

IQM Garnet

{
"argv": [
"/usr/bin/docker",
"run",
"--network=host",
"-v",
"{connection_file}:/connection-spec",
"--gpus", "all",
"--env", "NVIDIA_VISIBLE_DEVICES=all",
"--env", "NVIDIA_DRIVER_CAPABILITIES=compute,utility",
"--mount",
"type=bind,source=/home/ec2-user/braket_workshops,target=/home/cudaq/braket_workshops",
"--mount",
"type=bind,source=/home/ec2-user/amazon-braket-examples/examples,target=/home/cudaq/braket_examples",
"cudaq-jupyter-kernel",
"python",
"-m",
"ipykernel_launcher",
"-f",
"/connection-spec"
],
"display_name": "docker_cudaq",
"language": "python"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment