[GH-ISSUE #56] How to bind gpu_id? #34

Closed
opened 2026-10-26 21:10:58 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Jocx-H on GitHub (Mar 11, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/56

My server has multiple GPUs, including A100 and H100. How should I specify H100 in test_core.py? When I use the following command, an error occurs:
gpu_id = 4
os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_id)
torch.cuda.set_device(gpu_id)
print(torch.cuda.current_device())
print(torch.cuda.get_device_name(4))
4
NVIDIA H100 PCIe
Library path:

['/path/to/DeepGEMM/deep_gemm']

Testing GEMM:
Traceback (most recent call last):
File "tests/test_core.py", line 164, in
test_gemm()
File "tests/test_core.py", line 78, in test_gemm
deep_gemm.gemm_fp8_fp8_bf16_nt(x_fp8, y_fp8, out)
File "/path/to/DeepGEMM/deep_gemm/jit_kernels/gemm.py", line 153, in gemm_fp8_fp8_bf16_nt
num_sms = get_num_sms()
File "/path/to/DeepGEMM/deep_gemm/jit_kernels/utils.py", line 28, in get_num_sms
_num_sms = torch.cuda.get_device_properties(device='cuda').multi_processor_count
File "/path/to/lib/python3.8/site-packages/torch/cuda/init.py", line 452, in get_device_properties
raise AssertionError("Invalid device id")
AssertionError: Invalid device id

I don't know why this happens

Originally created by @Jocx-H on GitHub (Mar 11, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/56 My server has multiple GPUs, including A100 and H100. How should I specify H100 in test_core.py? When I use the following command, an error occurs: gpu_id = 4 os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_id) torch.cuda.set_device(gpu_id) print(torch.cuda.current_device()) print(torch.cuda.get_device_name(4)) 4 NVIDIA H100 PCIe Library path: > ['/path/to/DeepGEMM/deep_gemm'] Testing GEMM: Traceback (most recent call last): File "tests/test_core.py", line 164, in <module> test_gemm() File "tests/test_core.py", line 78, in test_gemm deep_gemm.gemm_fp8_fp8_bf16_nt(x_fp8, y_fp8, out) File "/path/to/DeepGEMM/deep_gemm/jit_kernels/gemm.py", line 153, in gemm_fp8_fp8_bf16_nt num_sms = get_num_sms() File "/path/to/DeepGEMM/deep_gemm/jit_kernels/utils.py", line 28, in get_num_sms _num_sms = torch.cuda.get_device_properties(device='cuda').multi_processor_count File "/path/to/lib/python3.8/site-packages/torch/cuda/__init__.py", line 452, in get_device_properties raise AssertionError("Invalid device id") AssertionError: Invalid device id I don't know why this happens
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepGEMM#34
No description provided.