Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aborted (core dumped) in oneflow.rand/zeros/ones #10518

Open
x0w3n opened this issue May 11, 2024 · 0 comments
Open

Aborted (core dumped) in oneflow.rand/zeros/ones #10518

x0w3n opened this issue May 11, 2024 · 0 comments
Labels
bug community events from community

Comments

@x0w3n
Copy link

x0w3n commented May 11, 2024

Summary

The code crashes when negative values are given as arguments to oneflow's rand/zeros/ones functions for generating tensors.

Code to reproduce bug

rand:

import oneflow
oneflow.rand(-1)  # crash

output:

terminate called after throwing an instance of 'oneflow::Exception'
  what():  Check failed: (-1 >= 0): elem_cnt must be non-negative, but got -1
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::ThreadCtx::TryReceiveAndRun()
  File "liboneflow.so", line <unknown>, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
  File "liboneflow.so", line <unknown>, in vm::Instruction::Compute()
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
  File "liboneflow.so", line <unknown>, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
  File "liboneflow.so", line <unknown>, in 
  File "oneflow/user/kernels/distributions/uniform_distribution.cpp", line 40, in operator()
    CHECK_GE_OR_THROW(elem_cnt, 0)
Error Type: oneflow.ErrorProto.check_failed_error
Stack trace (most recent call last) in thread 123483:
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c8217ac249, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c8217ab847, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c8217a7368, in vm::ThreadCtx::TryReceiveAndRun()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c82173e818, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c821742be6, in vm::Instruction::Compute()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c821748d2a, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c8217484af, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c82174dd90, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c8225072d0, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c821c59633, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c821c37a81, in UniformDistribution<(DeviceType)1, float>::operator()(ep::Stream*, long, float*, std::shared_ptr<Generator> const&) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c821c3411e, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x70c81db48190, in 

Aborted (Signal sent by tkill() 123243 0)
Aborted (core dumped)

zeros:

import oneflow
oneflow.zeros(-1) # crash

output:

terminate called after throwing an instance of 'oneflow::Exception'
  what():  Check failed: (-1 >= 0): 
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::ThreadCtx::TryReceiveAndRun()
  File "liboneflow.so", line <unknown>, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
  File "liboneflow.so", line <unknown>, in vm::Instruction::Compute()
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
  File "liboneflow.so", line <unknown>, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
  File "oneflow/user/kernels/constant_kernel.cpp", line 47, in Compute
    CHECK_GE_OR_THROW(elem_cnt, 0)
Error Type: oneflow.ErrorProto.check_failed_error
Stack trace (most recent call last) in thread 123934:
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e30ac249, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e30ab847, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e30a7368, in vm::ThreadCtx::TryReceiveAndRun()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e303e818, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e3042be6, in vm::Instruction::Compute()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e3048d2a, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e30484af, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e304dd90, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e3e07589, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e33db793, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02e06c5c32, in details::Throw::operator=(Error&&)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7c02df448190, in 

Aborted (Signal sent by tkill() 123694 0)
Aborted (core dumped)

ones:

import oneflow
oneflow.ones (-1) # crash

output:

terminate called after throwing an instance of 'oneflow::Exception'
  what():  Check failed: (-1 >= 0): 
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::ThreadCtx::TryReceiveAndRun()
  File "liboneflow.so", line <unknown>, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
  File "liboneflow.so", line <unknown>, in vm::Instruction::Compute()
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
  File "liboneflow.so", line <unknown>, in 
  File "liboneflow.so", line <unknown>, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
  File "liboneflow.so", line <unknown>, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
  File "oneflow/user/kernels/constant_kernel.cpp", line 47, in Compute
    CHECK_GE_OR_THROW(elem_cnt, 0)
Error Type: oneflow.ErrorProto.check_failed_error
Stack trace (most recent call last) in thread 124264:
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daafc249, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daafb847, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daaf7368, in vm::ThreadCtx::TryReceiveAndRun()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daa8e818, in vm::EpStreamPolicyBase::Run(vm::Instruction*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daa92be6, in vm::Instruction::Compute()
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daa98d2a, in vm::OpCallInstructionPolicy::Compute(vm::Instruction*)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daa984af, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541daa9dd90, in vm::OpCallInstructionUtil::Compute(vm::OpCallInstructionPolicy*, vm::Stream*, bool, bool)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541db857589, in StatefulOpKernel::Compute(eager::CallContext*, ep::Stream*, user_op::OpKernel const*, user_op::OpKernelState*, user_op::OpKernelCache const*) const
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541dae2b793, in 
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541d8115c32, in details::Throw::operator=(Error&&)
   Object "/home/temp/oneflow-1.0.0/build/liboneflow.so", at 0x7541d6e98190, in 

Aborted (Signal sent by tkill() 124024 0)
Aborted (core dumped)

System Information

  • What is your OneFlow installation (pip, source, dockerhub): pip
  • OS: Ubuntu 22.04.3 LTS
  • OneFlow version (run python3 -m oneflow --doctor):
path: ['*/temp/oneflow-1.0.0/python/oneflow']
version: 0.9.1+cpu.git.ec05076
git_commit: ec05076
cmake_build_type: Release
rdma: False
mlir: False
  • Python version: 3.10.0
  • CUDA driver version: 12.2
  • GPU models: NVIDIA GeForce RTX 3090
  • Other info: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community events from community
Projects
None yet
Development

No branches or pull requests

1 participant