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

thrust: add v2.2.0 #22231

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions recipes/thrust/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
41 changes: 24 additions & 17 deletions recipes/thrust/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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 = []
Expand All @@ -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
6 changes: 6 additions & 0 deletions recipes/thrust/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#ifndef __host__
#define __host__
#endif
#ifndef __device__
#define __device__
#endif
#include "test_package.cuh"

#include <iostream>
Expand Down
6 changes: 3 additions & 3 deletions recipes/thrust/config.yml
Original file line number Diff line number Diff line change
@@ -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
Loading