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

Add recipe for warp-lang #24493

Merged
merged 22 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 19 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
54 changes: 54 additions & 0 deletions recipes/warp-lang/01-find_g++_env.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/build_lib.py b/build_lib.py
--- a/build_lib.py
+++ b/build_lib.py
@@ -101,6 +101,8 @@ if os.name == "nt":
if not warp.config.host_compiler:
print("Warp build error: Could not find MSVC compiler")
sys.exit(1)
+else:
+ warp.config.host_compiler = find_host_compiler()


# return platform specific shared library name
diff --git a/warp/build_dll.py b/warp/build_dll.py
--- a/warp/build_dll.py
+++ b/warp/build_dll.py
@@ -101,7 +101,7 @@ def find_host_compiler():
else:
# try and find g++
try:
- return run_cmd("which g++").decode()
+ return run_cmd("echo $CXX").decode().strip() if run_cmd("echo $CXX") != b"\xA0" else run_cmd("which g++").decode().strip()
except:
return ""

@@ -308,7 +308,7 @@ def build_dll_for_arch(dll_path, cpp_paths, cu_path, libs, mode, arch, verify_fp
cpp_out = cpp_path + ".o"
ld_inputs.append(quote(cpp_out))

- build_cmd = f'g++ {cpp_flags} -c "{cpp_path}" -o "{cpp_out}"'
+ build_cmd = f'{warp.config.host_compiler} {cpp_flags} -c "{cpp_path}" -o "{cpp_out}"'
run_cmd(build_cmd)

if cu_path:
@@ -337,7 +337,7 @@ def build_dll_for_arch(dll_path, cpp_paths, cu_path, libs, mode, arch, verify_fp

with ScopedTimer("link", active=warp.config.verbose):
origin = "@loader_path" if (sys.platform == "darwin") else "$ORIGIN"
- link_cmd = f"g++ {target} -shared -Wl,-rpath,'{origin}' {opt_no_undefined} {opt_exclude_libs} -o '{dll_path}' {' '.join(ld_inputs + libs)}"
+ link_cmd = f"{warp.config.host_compiler} {target} -shared -Wl,-rpath,'{origin}' {opt_no_undefined} {opt_exclude_libs} -o '{dll_path}' {' '.join(ld_inputs + libs)}"
run_cmd(link_cmd)

# Strip symbols to reduce the binary size
diff --git a/warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py b/warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py
--- a/warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py
+++ b/warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py
@@ -305,7 +305,7 @@ class ArtifactManager:

# compile the host code
options = compilation_options.get()
- cmd = "echo '%s'|g++ -x c++ -fpermissive -w -fPIC" % source_buffer_host
+ cmd = "echo '%s'|$CXX -x c++ -fpermissive -w -fPIC" % source_buffer_host
for opt in options:
opt = opt.decode("utf-8")
if opt not in ['-default-device', '-std=c++11', '-Xcicc', '-Xllc'] and '-arch=sm_' not in opt:
12 changes: 12 additions & 0 deletions recipes/warp-lang/02-add_macro_def_build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/warp/build_dll.py b/warp/build_dll.py
--- a/warp/build_dll.py
+++ b/warp/build_dll.py
@@ -293,7 +293,7 @@ def build_dll_for_arch(dll_path, cpp_paths, cu_path, libs, mode, arch, verify_fp
cpp_flags = f'{target} -O0 -g -fno-rtti -D_DEBUG -DWP_ENABLE_DEBUG=1 -D{cuda_enabled} -D{cutlass_enabled} -D{cuda_compat_enabled} -fPIC -fvisibility=hidden --std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 -fkeep-inline-functions -I"{native_dir}" {includes}'

if mode == "release":
- cpp_flags = f'{target} -O3 -DNDEBUG -DWP_ENABLE_DEBUG=0 -D{cuda_enabled} -D{cutlass_enabled} -D{cuda_compat_enabled} -fPIC -fvisibility=hidden --std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 -I"{native_dir}" {includes}'
+ cpp_flags = f'{target} -O3 -DNDEBUG -DWP_ENABLE_DEBUG=0 -D{cuda_enabled} -D{cutlass_enabled} -D{cuda_compat_enabled} -fPIC -fvisibility=hidden --std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 -I"{native_dir}" {includes} -D__STDC_FORMAT_MACROS'

if verify_fp:
cpp_flags += " -DWP_VERIFY_FP"
14 changes: 14 additions & 0 deletions recipes/warp-lang/03-install_deps_llvm_conda.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/build_llvm.py b/build_llvm.py
--- a/build_llvm.py
+++ b/build_llvm.py
@@ -43,10 +43,6 @@ for arch in packages:


def build_from_source_for_arch(args, arch):
- # Install dependencies
- subprocess.check_call([sys.executable, "-m", "pip", "install", "gitpython"])
- subprocess.check_call([sys.executable, "-m", "pip", "install", "cmake"])
- subprocess.check_call([sys.executable, "-m", "pip", "install", "ninja"])

from git import Repo

60 changes: 60 additions & 0 deletions recipes/warp-lang/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{% set name = "warp-lang" %}
{% set version = "0.10.1" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/NVIDIA/warp/archive/refs/tags/v{{ version }}.tar.gz
sha256: fc80bc6c38ac2e0a1a59f9dc912a29692bcf3db2848625890fbcdac45b2c06c9
patches:
- 01-find_g++_env.patch
- 02-add_macro_def_build.patch
- 03-install_deps_llvm_conda.patch

build:
script:
- {{ PYTHON }} build_lib.py
- {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation --no-cache-dir
number: 0
skip: true # [osx]

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
flferretti marked this conversation as resolved.
Show resolved Hide resolved
host:
flferretti marked this conversation as resolved.
Show resolved Hide resolved
- python
- pip
- gitpython
- cmake
- ninja
flferretti marked this conversation as resolved.
Show resolved Hide resolved
- numpy
run:
- python

test:
imports:
- warp
commands:
- pip check
# Python tests require CUDA 11.5
# - {{ PYTHON }} -m warp.test
requires:
- pip
- pytest

about:
home: https://github.com/NVIDIA/warp
summary: 'A Python framework for high-performance simulation and graphics programming.'
license: BSD-4-Clause AND BSD-3-Clause
flferretti marked this conversation as resolved.
Show resolved Hide resolved
license_file:
- copyright.py
- LICENSE.md
- warp/native/cutlass/LICENSE.txt
flferretti marked this conversation as resolved.
Show resolved Hide resolved
flferretti marked this conversation as resolved.
Show resolved Hide resolved

extra:
recipe-maintainers:
- flferretti
- traversaro