Skip to content

Commit

Permalink
Initial feedstock commit with conda-smithy 3.23.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
conda-forge-admin committed May 16, 2023
0 parents commit af17f48
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 0 deletions.
1 change: 1 addition & 0 deletions conda-forge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
35 changes: 35 additions & 0 deletions recipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(verify_cuda_compiler LANGUAGES CUDA)

if(NOT DEFINED CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
message(FATAL_ERROR "CUDA compiler detection failed, no recording of CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES")
endif()

find_package(CUDAToolkit REQUIRED)
set(should_exist
CUDAToolkit_BIN_DIR
CUDAToolkit_INCLUDE_DIRS
CUDAToolkit_LIBRARY_DIR
CUDAToolkit_LIBRARY_ROOT
)
foreach (cuda_loc_var IN LISTS should_exist)
if(NOT EXISTS "${${cuda_loc_var}}")
message(FATAL_ERROR "${cuda_loc} should exist on disk")
endif()
endforeach()


set(cuda_libs cudart cuda_driver)
foreach (cuda_lib IN LISTS cuda_libs)
if(NOT CUDA_${cuda_lib}_LIBRARY)
message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found")
elseif(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]])
message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..")
endif()
if(NOT TARGET CUDA::${cuda_lib})
message(FATAL_ERROR "expected CUDAToolkit target CUDA::${cuda_lib} not found")
endif()
endforeach()

add_executable(verify test.cu)
8 changes: 8 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if not exist %PREFIX% mkdir %PREFIX%

move lib\x64\* %LIBRARY_LIB%
move bin\* %LIBRARY_BIN%
move bin\crt %LIBRARY_BIN%
move include\* %LIBRARY_INC%
move include\crt %LIBRARY_INC%
move nvvm %PREFIX%\Library
48 changes: 48 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Install to conda style directories
[[ -d lib64 ]] && mv lib64 lib

[[ ${target_platform} == "linux-64" ]] && targetsDir="targets/x86_64-linux"
[[ ${target_platform} == "linux-ppc64le" ]] && targetsDir="targets/ppc64le-linux"
[[ ${target_platform} == "linux-aarch64" ]] && targetsDir="targets/sbsa-linux"

for i in `ls`; do
[[ $i == "build_env_setup.sh" ]] && continue
[[ $i == "conda_build.sh" ]] && continue
[[ $i == "metadata_conda_debug.yaml" ]] && continue
if [[ $i == "bin" ]] || [[ $i == "lib" ]] || [[ $i == "include" ]] || [[ $i == "nvvm" ]]; then
# Headers and libraries are installed to targetsDir
mkdir -p ${PREFIX}/${targetsDir}
mkdir -p ${PREFIX}/$i
if [[ $i == "bin" ]]; then
mkdir -p ${PREFIX}/${targetsDir}/bin
cp -rv $i ${PREFIX}
ln -sv ${PREFIX}/bin/nvcc ${PREFIX}/${targetsDir}/bin/nvcc
elif [[ $i == "lib" ]]; then
cp -rv $i ${PREFIX}/${targetsDir}
for j in "$i"/*.a*; do
# Static libraries are symlinked in $PREFIX/lib
ln -sv ${PREFIX}/${targetsDir}/$j ${PREFIX}/$j
done
ln -sv ${PREFIX}/${targetsDir}/lib ${PREFIX}/${targetsDir}/lib64
elif [[ $i == "include" ]]; then
cp -rv $i ${PREFIX}/${targetsDir}
elif [[ $i == "nvvm" ]]; then
cp -rv $i ${PREFIX}
ln -sv ${PREFIX}/nvvm ${PREFIX}/${targetsDir}/nvvm
fi
else
cp -rv $i ${PREFIX}/${targetsDir}
fi
done

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
# Name this script starting with `~` so it is run after all other compiler activation scripts.
# At the point of running this, $CXX must be defined.
# for CHANGE in "activate" "deactivate"
# do
# mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
# cp "${RECIPE_DIR}/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/~cuda-nvcc_${CHANGE}.sh"
# done
6 changes: 6 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
c_compiler_version: # [linux]
- 12 # [linux]
cxx_compiler_version: # [linux]
- 12 # [linux]
arm_variant_type: # [aarch64]
- sbsa # [aarch64]
182 changes: 182 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{% set name = "cuda-nvcc-impl" %}
{% set version = "12.0.76" %}
{% set cuda_version = "12.0" %}
{% set platform = "linux-x86_64" %} # [linux64]
{% set platform = "linux-ppc64le" %} # [ppc64le]
{% set platform = "linux-sbsa" %} # [aarch64]
{% set platform = "windows-x86_64" %} # [win]
{% set target_name = "x86_64-linux" %} # [linux64]
{% set target_name = "ppc64le-linux" %} # [ppc64le]
{% set target_name = "sbsa-linux" %} # [aarch64]
{% set target_name = "x64" %} # [win]
{% set extension = "tar.xz" %} # [not win]
{% set extension = "zip" %} # [win]

package:
name: cuda-nvcc-impl-split
version: {{ version }}

source:
url: https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/{{ platform }}/cuda_nvcc-{{ platform }}-{{ version }}-archive.{{ extension }}
sha256: 160ca9f8828f53daa4b2066c5361aacb45fa2575885f70c223cda1d11df53d6f # [linux64]
sha256: dc5bd7eac57b32a9645c0c23c6a1ba8a9533e846eeec31414e1aa4230afee2f8 # [ppc64le]
sha256: 85c8c643ea2cfa398e1b5ffcd597f5bb3b738526c9e3fb8e39dd909c55345f36 # [aarch64]
sha256: f67406f44263f0e4a110a8cf0200bff1d3d0e32917db8a7c9e417a87eb7ca372 # [win]
patches:
- nvcc.profile.patch # [linux]
- nvcc.profile.patch.win # [win]

build:
number: 0
skip: true # [osx or win]

outputs:
- name: cuda-nvcc-tools
files:
- bin # [linux]
- nvvm/bin # [linux]
- nvvm/libdevice # [linux]
requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- sysroot_{{ target_platform }} 2.17 # [linux]
host:
- arm-variant * {{ arm_variant_type }} # [aarch64]
- cuda-version {{ cuda_version }}
run:
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
run_constrained:
- gcc_impl_{{ target_platform }} >=6,<13 # [linux]
- arm-variant * {{ arm_variant_type }} # [aarch64]
test:
commands:
- test -f $PREFIX/bin/nvcc # [linux]
- test -f $PREFIX/bin/ptxas # [linux]
- test -d $PREFIX/nvvm # [linux]
- test -f $PREFIX/nvvm/bin/cicc # [linux]
about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: Architecture independent part of CUDA NVCC compiler.
description: |
Compiler for CUDA applications.
doc_url: https://docs.nvidia.com/cuda/index.html

- name: cuda-nvcc-dev_{{ target_platform }}
build:
noarch: generic
run_exports:
strong:
- cuda-version >={{ cuda_version }},<{{ cuda_version.split(".")[0]|int + 1 }}
files:
# targets/{{ target_name }}/bin/nvcc is only a symlink
- targets/{{ target_name }}/bin # [linux]
- targets/{{ target_name }}/nvvm # [linux]
- targets/{{ target_name }}/include # [linux]
- targets/{{ target_name }}/lib # [linux]
- Library\bin # [win]
- Library\nvvm # [win]
- Library\include # [win]
- Library\lib # [win]
requirements:
build:
host:
- arm-variant * {{ arm_variant_type }} # [aarch64]
- cuda-version {{ cuda_version }}
- cuda-nvcc-tools {{ cuda_version }}
run:
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
run_constrained:
- gcc_impl_{{ target_platform }} >=6,<13 # [linux]
- arm-variant * {{ arm_variant_type }} # [aarch64]
test:
commands:
- test -L $PREFIX/targets/{{ target_name }}/bin/nvcc # [linux]
- test -L $PREFIX/targets/{{ target_name }}/nvvm # [linux]
- test -f $PREFIX/targets/{{ target_name }}/lib/libnvptxcompiler_static.a # [linux]
- test -f $PREFIX/targets/{{ target_name }}/include/nvPTXCompiler.h # [linux]
- if not exist %LIBRARY_LIB%\nvptxcompiler_static.lib exit 1 # [win]
- if not exist %LIBRARY_INC%\nvPTXCompiler.h exit 1 # [win]
about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: Target architecture dependent parts of CUDA NVCC compiler.
description: |
Compiler for CUDA applications.
doc_url: https://docs.nvidia.com/cuda/index.html

- name: cuda-nvcc-impl
build:
# libnvvm.so gets corrupted by patchelf. No need to relocate as it is already relocatable
binary_relocation: False
run_exports:
strong:
- cuda-version >={{ cuda_version }},<{{ cuda_version.split(".")[0]|int + 1 }}
files:
- lib/libnvptxcompiler_static.a # [linux]
- nvvm/include # [linux]
- nvvm/lib64 # [linux]
requirements:
build:
- sysroot_{{ target_platform }} 2.17 # [linux]
host:
- arm-variant * {{ arm_variant_type }} # [aarch64]
- cuda-version {{ cuda_version }}
- cuda-cudart-dev
run:
- {{ pin_subpackage("cuda-nvcc-tools", exact=True) }}
- {{ pin_subpackage("cuda-nvcc-dev_" + target_platform, exact=True) }}
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
- cuda-cudart-dev
run_constrained:
- gcc_impl_{{ target_platform }} >=6,<13 # [linux]
- arm-variant * {{ arm_variant_type }} # [aarch64]
test:
requires:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- gxx
- gcc
- cmake
- cuda-driver-dev
- git # [linux]
- ninja
files:
- test.cu
- CMakeLists.txt
- run_cmake_cuda_tests.sh # [linux]
commands:
- test -L $PREFIX/lib/libnvptxcompiler_static.a # [linux]
- nvcc --version
- nvcc --verbose test.cu
- cmake -S . -B ./build -G=Ninja && cmake --build ./build -v
- bash ./run_cmake_cuda_tests.sh # [linux and (x86_64 or aarch64)]
about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: Compiler for CUDA applications.
description: |
Compiler for CUDA applications.
doc_url: https://docs.nvidia.com/cuda/index.html

about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: Compiler for CUDA applications.
description: |
Compiler for CUDA applications.
doc_url: https://docs.nvidia.com/cuda/index.html

extra:
feedstock-name: cuda-nvcc-impl
recipe-maintainers:
- adibbley
21 changes: 21 additions & 0 deletions recipe/nvcc.profile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- bin/nvcc.profile.bak 2023-05-12 17:14:18.957422747 -0500
+++ bin/nvcc.profile 2023-05-12 18:08:02.746114493 -0500
@@ -1,14 +1,14 @@

-TOP = $(_HERE_)/..
+TOP = $(_HERE_)/../$(_TARGET_DIR_)

NVVMIR_LIBRARY_DIR = $(TOP)/$(_NVVM_BRANCH_)/libdevice

LD_LIBRARY_PATH += $(TOP)/lib:
-PATH += $(TOP)/$(_NVVM_BRANCH_)/bin:$(_HERE_):
+PATH += $(TOP)/bin:$(TOP)/$(_NVVM_BRANCH_)/bin:$(TOP)/../../bin:$(TOP)/../../$(_NVVM_BRANCH_)/bin:

-INCLUDES += "-I$(TOP)/$(_TARGET_DIR_)/include" $(_SPACE_)
+INCLUDES += "-I$(TOP)/include" $(_SPACE_)

-LIBRARIES =+ $(_SPACE_) "-L$(TOP)/$(_TARGET_DIR_)/lib$(_TARGET_SIZE_)/stubs" "-L$(TOP)/$(_TARGET_DIR_)/lib$(_TARGET_SIZE_)"
+LIBRARIES =+ $(_SPACE_) "-L$(TOP)/lib/stubs" "-L$(TOP)/lib"

CUDAFE_FLAGS +=
PTXAS_FLAGS +=
14 changes: 14 additions & 0 deletions recipe/nvcc.profile.patch.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- bin/nvcc.profile 2023-03-23 15:56:49.535384866 -0400
+++ bin/nvcc.profile.new 2023-03-23 19:21:08.071151138 -0400
@@ -5,9 +5,9 @@

PATH += $(TOP)/$(_NVVM_BRANCH_)/bin;$(_HERE_);$(TOP)/lib;

-INCLUDES += "-I$(TOP)/include" $(_SPACE_)
+INCLUDES += "-I$(TOP)/include" $(_SPACE_) "-I$(TOP)/include/targets/$(_WIN_PLATFORM_)" $(_SPACE_)

-LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)"
+LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" $(_SPACE_) "/LIBPATH:$(TOP)/lib"

CUDAFE_FLAGS +=
PTXAS_FLAGS +=
29 changes: 29 additions & 0 deletions recipe/run_cmake_cuda_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e
set -x
cmake_version=$(cmake --version | grep version | awk '{print $3}')

mkdir -p cmake-tests
git clone -b v${cmake_version} --depth 1 https://gitlab.kitware.com/cmake/cmake.git cmake-tests
cmake -S cmake-tests -B cmake-tests/build -DCMake_TEST_HOST_CMAKE=ON -DCMake_TEST_CUDA=nvcc -G "Ninja"
cd cmake-tests/build

# Test exclusion list:
# Requires cublas
# Cuda.ProperDeviceLibraries
#
# Requires curand
# *SharedRuntime*
#
# Requires execution on a machine with a CUDA GPU
# Cuda.ObjectLibrary
# Cuda.WithC
# CudaOnly.ArchSpecial
# CudaOnly.GPUDebugFlag
# CudaOnly.SeparateCompilationPTX
# CudaOnly.WithDefs
# RunCMake.CUDA_architectures
# *Toolkit*
# Failing due to undefined symbol: __libc_dl_error_tsd, version GLIBC_PRIVATE
# Cuda.Complex
CUDAHOSTCXX=$CXX ctest -L CUDA --output-on-failure -j $(nproc) -E "(ProperDeviceLibraries|SharedRuntime|ObjectLibrary|WithC|ArchSpecial|GPUDebugFlag|SeparateCompilationPTX|WithDefs|CUDA_architectures|Toolkit|Cuda.Complex)"
3 changes: 3 additions & 0 deletions recipe/test.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
return 0;
}

0 comments on commit af17f48

Please sign in to comment.