diff --git a/recipes/thrust/all/conandata.yml b/recipes/thrust/all/conandata.yml index 4912f01513e01..7396ea71f7199 100644 --- a/recipes/thrust/all/conandata.yml +++ b/recipes/thrust/all/conandata.yml @@ -1,10 +1,10 @@ sources: - "1.16.0": - url: "https://github.com/thrust/thrust/archive/1.16.0.tar.gz" - sha256: "93b9553e3ee544e05395022bea67e6d600f8f3eb680950ec7cf73c0f55162487" - "1.17.0": - url: "https://github.com/thrust/thrust/archive/1.17.0.tar.gz" - sha256: "b02aca5d2325e9128ed9d46785b8e72366f758b873b95001f905f22afcf31bbf" + "2.6.1": + url: "https://github.com/NVIDIA/cccl/archive/refs/tags/v2.6.1.tar.gz" + sha256: "993f483a3f8134bd719dc61651c0a0db17ad6007ee22e97f4ac4a3c310834004" "1.17.2": url: "https://github.com/thrust/thrust/archive/1.17.2.tar.gz" sha256: "d021e37f5aac30fd1b9737865399feb57db8e601ae2fc0af3cd41784435e9523" + "1.16.0": + url: "https://github.com/thrust/thrust/archive/1.16.0.tar.gz" + sha256: "93b9553e3ee544e05395022bea67e6d600f8f3eb680950ec7cf73c0f55162487" diff --git a/recipes/thrust/all/conanfile.py b/recipes/thrust/all/conanfile.py index 1519ec256e76b..57a6707db9014 100644 --- a/recipes/thrust/all/conanfile.py +++ b/recipes/thrust/all/conanfile.py @@ -1,8 +1,9 @@ import os from conan import ConanFile -from conan.tools.files import copy, get +from conan.tools.files import copy, get, move_folder_contents, rmdir from conan.tools.layout import basic_layout +from conan.tools.scm import Version required_conan_version = ">=1.52.0" @@ -15,8 +16,9 @@ class ThrustConan(ConanFile): "the C++ Standard Template Library (STL)." ) topics = ("parallel", "stl", "header-only", "cuda", "gpgpu") - homepage = "https://thrust.github.io/" + homepage = "https://nvidia.github.io/thrust/" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -31,8 +33,11 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - # Otherwise CUB from system CUDA is used, which is not guaranteed to be compatible - self.requires("cub/1.17.2") + if Version(self.version) >= "2.0": + self.requires(f"cub/{self.version}") + self.requires(f"libcudacxx/{self.version}") + else: + self.requires("cub/1.17.2") if self.options.device_system == "tbb": self.requires("onetbb/2021.10.0") @@ -48,22 +53,22 @@ def package_id(self): self.info.clear() def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + if Version(self.version) >= "2.0": + tmpdir = os.path.join(self.export_sources_folder, "tmp") + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=tmpdir) + move_folder_contents(self, os.path.join(tmpdir, "thrust"), self.source_folder) + rmdir(self, tmpdir) + else: + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - copy( - self, - pattern="LICENSE", - dst=os.path.join(self.package_folder, "licenses"), - src=self.source_folder, - ) + copy(self, "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) for pattern in ["*.h", "*.inl"]: - copy( - self, - pattern=pattern, - src=os.path.join(self.source_folder, "thrust"), - dst=os.path.join(self.package_folder, "include", "thrust"), - ) + copy(self, pattern, + src=os.path.join(self.source_folder, "thrust"), + dst=os.path.join(self.package_folder, "include", "thrust")) def package_info(self): self.cpp_info.bindirs = [] @@ -72,3 +77,5 @@ def package_info(self): self.cpp_info.defines = [f"THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_{dev}"] # Since CUB and Thrust are provided separately, their versions are not guaranteed to match self.cpp_info.defines += ["THRUST_IGNORE_CUB_VERSION_CHECK=1"] + + # TODO: apply https://github.com/NVIDIA/cccl/blob/main/thrust/thrust/cmake/thrust-config.cmake diff --git a/recipes/thrust/all/test_package/test_package.cpp b/recipes/thrust/all/test_package/test_package.cpp index 28f5508b5fd2f..7e5cdc149ded8 100644 --- a/recipes/thrust/all/test_package/test_package.cpp +++ b/recipes/thrust/all/test_package/test_package.cpp @@ -1,3 +1,9 @@ +#ifndef __host__ +#define __host__ +#endif +#ifndef __device__ +#define __device__ +#endif #include "test_package.cuh" #include diff --git a/recipes/thrust/config.yml b/recipes/thrust/config.yml index f07d47b001a70..0b4e213a19d77 100644 --- a/recipes/thrust/config.yml +++ b/recipes/thrust/config.yml @@ -1,7 +1,7 @@ versions: - "1.16.0": - folder: all - "1.17.0": + "2.6.1": folder: all "1.17.2": folder: all + "1.16.0": + folder: all