oneflow icon indicating copy to clipboard operation
oneflow copied to clipboard

Aborted (core dumped) in `flow.cuda.get_device_properties`

Open Daisy2ang opened this issue 1 year ago • 0 comments

Summary

When calling flow.cuda.get_device_properties(), an invalid device ID is specified, causing the cudaSetDevice() call to fail, resulting in a crash and a core dump.

Code to reproduce bug

import oneflow as flow
import oneflow.cuda
flow.cuda.get_device_properties(-3)

output:

F20250630 23:50:47.338798 31011 cuda_util.cpp:232] Check failed: cudaSetDevice(device_id) : invalid device ordinal (101) 
*** Check failure stack trace: ***
    @     0x7fcb6bbd09ca  google::LogMessage::Fail()
    @     0x7fcb6bbd0cb2  google::LogMessage::SendToLog()
    @     0x7fcb6bbd0537  google::LogMessage::Flush()
    @     0x7fcb6bbd30a9  google::LogMessageFatal::~LogMessageFatal()
    @     0x7fcb6151f120  _ZZSt9call_onceIZN7oneflow19InitCudaContextOnceEiEUlvE_JEEvRSt9once_flagOT_DpOT0_ENUlvE0_4_FUNEv
    @     0x7fcc52eb0ee8  (unknown)
    @     0x7fcb6151f282  oneflow::InitCudaContextOnce()
    @     0x7fcb6151f3e8  oneflow::GetDeviceProperties()
    @     0x7fcc4afeb2b0  (unknown)
    @     0x7fcc4af84d2d  (unknown)
    @     0x55dcfa406df4  cfunction_call
    @     0x55dcfa3cdd1e  _PyObject_MakeTpCall.localalias.3
    @     0x55dcfa471715  _PyEval_EvalFrameDefault
    @     0x55dcfa41b1eb  _PyEval_Vector
    @     0x55dcfa39a69e  _PyEval_EvalFrameDefault.cold.3100
    @     0x55dcfa41b1eb  _PyEval_Vector
    @     0x55dcfa42c0e8  PyEval_EvalCode
    @     0x55dcfa4dcf1b  run_eval_code_obj
    @     0x55dcfa512805  run_mod
    @     0x55dcfa514bb0  pyrun_file
    @     0x55dcfa514d98  _PyRun_SimpleFileObject.localalias.11
    @     0x55dcfa514ea4  _PyRun_AnyFileObject.localalias.17
    @     0x55dcfa51605f  Py_RunMain.localalias.0
    @     0x55dcfa5161e9  Py_BytesMain
    @     0x7fcc52e40d90  (unknown)
    @     0x7fcc52e40e40  __libc_start_main
    @     0x55dcfa49ae86  (unknown)
Aborted (core dumped)

System Information

  • What is your OneFlow installation (pip, source, dockerhub): pip
  • OS: Ubuntu 22.04.5 LTS
  • OneFlow version (run python3 -m oneflow --doctor): path: ['/root/anaconda3/envs/oneflow1.0.0/lib/python3.10/site-packages/oneflow'] version: 0.9.0 git_commit: https://github.com/Oneflow-Inc/oneflow/commit/381b12cb083a1cf0ad2376dae047f058f26ad284 cmake_build_type: Release rdma: True mlir: True
  • Python version: 3.10.0
  • CUDA driver version: 12.2
  • GPU models: NVIDIA GeForce RTX 4090
  • Other info: None

Daisy2ang avatar Jun 30 '25 14:06 Daisy2ang