isl-org / isl-org/Open3D

BUILD_CUDA_MODULE not detected when calling ParallelFor

Open
#4,370 5 comments 0 reactions 1 assignee Claimed by @reyanshsolis View on GitHub
build/install
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

**Describe the bug**
Hi, I have a project with cpp and cu files and I was trying to use ParallelForCUDA in a cu file in order to accelerate tensor operations. When I compile it I get the following errors:

/usr/local/include/open3d/core/ParallelFor.h(78): error: identifier "CUDAScopedDevice" is undefined
detected during instantiation of "void open3d::core::ParallelFor(const open3d::core::Device &, int64_t, const func_t &) [with func_t=lambda [](int64_t) mutable->void]"

/usr/local/include/open3d/core/ParallelFor.h(83): error: namespace "open3d::core::cuda" has no member "GetStream"
detected during instantiation of "void open3d::core::ParallelFor(const open3d::core::Device &, int64_t, const func_t &) [with func_t=lambda [](int64_t) mutable->void]"

It seems that the problem is in the #ifdef BUILD_CUDA_MODULE of the library CUDAUtils.h, I reinstalled Open3D to make sure that this flag was activated when building from source but it didn't solve the errors, I don't know why it isn't detected...

**To Reproduce**
Steps to reproduce the behavior:
In a cu file, include a library file (.h) in which you include others libraries for both cpp and cu files and mark conditional compilation to include CUDAUtils (see image below). Create tensors at device CUDA:0, create a lambda where you operate with them and call ParallelFor.

**Expected behavior**
BUILD_CUDA_MODULE detected and all classes/members from CUDAUtils defined.

**Screenshots**
![imagen](https://user-images.githubusercontent.com/92014310/144571823-8a6b20cb-630e-4f24-85dc-80ecda018577.png)
__CUDACC__ is well defined when compiling.

**Environment (please complete the following information):**

- Operating system: (Ubuntu 18.04.6 LTS)
- Python version: (Python 2.7.17, I don't use it in my project)
- Open3D version: 0.13.0
- Is this remote workstation?: no
- How did you install Open3D?: (build from source)
- Compiler version (if built from source): (gcc 7.5, NVIDIA 11.0.221)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.