你可以输入这个命令,查看你的电脑Cuda版本。
wu@wu:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Feb_27_16:19:38_PST_2024
Cuda compilation tools, release 12.4, V12.4.99
Build cuda_12.4.r12.4/compiler.33961263_0
比如我这里是12.4版本。
Open3D的v0.19 release,是支持 CUDA 12,以及使用 CUDA 动态库构建的支持。
接下来就来安装支持Cuda12.4的Open3D的GPU版本。
首先点击这个,下载这个版本,他是支持Cuda12.4的。
下载好后,解压缩就可以了,不需要编译。
open3d_cuda12.4_test是我的测试文件夹。用来测试GPU是否可以使用,在windows下,Open3d是不支持GPU加速的。
sudo apt update
sudo apt install libc++-dev libc++abi-dev
这会安装 libc++.so.1
到 /usr/lib/x86_64-linux-gnu/
。
否则会报错
/usr/bin/ld: warning: libc++.so.1, needed by ...libOpen3D.so..., not found (try using -rpath or -rpath-link)
...
undefined reference to `std::__1::...'
- CMakeLists.txt
cmake_minimum_required(VERSION 3.08)
project(open3d_cuda_test)
set(CMAKE_CXX_STANDARD 17)
# TODO:Modify Path
set(Open3D_DIR "/home/wu/dependency_management/open3d-devel-linux-x86_64-cxx11-abi-cuda-0.19.0/lib/cmake/Open3D")
# 打印调试信息
message(STATUS "Looking for Open3D in: ${Open3D_DIR}")
# 查找 Open3D 包
find_package(Open3D REQUIRED CONFIG)
# 打印调试信息
message(STATUS "Found Open3D version: ${Open3D_VERSION}")
message(STATUS "Open3D include dirs: ${Open3D_INCLUDE_DIRS}")
message(STATUS "Open3D libraries: ${Open3D_LIBRARIES}")
# TODO:Modify Path
include_directories(/home/wu/dependency_management/open3d-devel-linux-x86_64-cxx11-abi-cuda-0.19.0/include
/home/wu/dependency_management/open3d-devel-linux-x86_64-cxx11-abi-cuda-0.19.0/include/open3d/3rdparty
/home/wu/dependency_management/open3d-devel-linux-x86_64-cxx11-abi-cuda-0.19.0/include/open3d/core)
add_executable(open3d_cuda_test main.cpp)
target_link_libraries(
open3d_cuda_test
PRIVATE
${Open3D_LIBRARIES}
)
target_link_libraries(open3d_cuda_test PUBLIC c++ c++abi)
set_target_properties(open3d_cuda_test PROPERTIES
BUILD_RPATH "/usr/lib/x86_64-linux-gnu"
)
注意需要修改这里的Open3D_DIR
和include_directories
中的绝对路径为自己电脑上的路径。
- main.cpp
#include <iostream>
#include <open3d/Open3D.h>
#include <open3d/core/CUDAUtils.h> // Include this for CUDA utilities
int main() {
using namespace open3d;
// Print Open3D version
std::cout << "Open3D " << OPEN3D_VERSION << std::endl;
// Check if CUDA is available
if (core::cuda::IsAvailable()) {
std::cout << "CUDA is available" << std::endl;
} else {
std::cout << "CUDA is NOT available" << std::endl;
}
// Create a simple point cloud
core::Tensor points = core::Tensor::Init<float>({{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}});
t::geometry::PointCloud pcd(points);
std::cout << "PointCloud:\n" << pcd.GetPointPositions().ToString() << std::endl;
return 0;
}
cd open3d_cuda12.4_test/build/
cmake ..
make
./open3d_cuda_test
https://github.com/isl-org/Open3D/releases
https://www.open3d.org/2025/01/09/open3d-v0-19-is-out-with-new-features-and-more-gpu-support/
https://www.open3d.org/docs/release/compilation.html#linux
Open3d入门指南:https://www.open3d.org/docs/latest/getting_started.html#c
已适配 find_dependencies.cmake 以使用 CUDA >= 12.0 并支持动态库:isl-org/Open3D#6815