forked from cscjlan/python-gpu-comparison
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPU_test.py
More file actions
21 lines (16 loc) · 679 Bytes
/
Copy pathGPU_test.py
File metadata and controls
21 lines (16 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from numba import cuda
def main():
print("Checking CUDA availability...")
if not cuda.is_available():
print("CUDA is not available. Please check your setup.")
return
print("CUDA is available!")
device = cuda.get_current_device()
print(f"Device Name: {device.name}")
# Get memory information using the current CUDA context
mem_info = cuda.current_context().get_memory_info()
print(f"Total Memory: {mem_info[1] / 1e9:.2f} GB") # Convert bytes to GB
print(f"Free Memory: {mem_info[0] / 1e9:.2f} GB") # Convert bytes to GB
print(f"Compute Capability: {device.compute_capability}")
if __name__ == "__main__":
main()