-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
218 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#! /bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
#pip install "cmake==3.22.*" | ||
rm setup.py | ||
mv setup_cuda.py setup.py | ||
# mv setup_cpu.py setup.py | ||
|
||
# https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/ | ||
|
||
# Install CUDA 11.2, see: | ||
# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/base/Dockerfile | ||
# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/devel/Dockerfile | ||
#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
#yum install --setopt=obsoletes=0 -y \ | ||
# cuda-nvcc-11-2-11.2.152-1 \ | ||
# cuda-cudart-devel-11-2-11.2.152-1 \ | ||
# libcurand-devel-11-2-10.2.3.152-1 \ | ||
# libcudnn8-devel-8.1.1.33-1.cuda11.2 \ | ||
# libcublas-devel-11-2-11.4.1.1043-1 | ||
#ln -s cuda-11.2 /usr/local/cuda | ||
# | ||
#yum install -y python3-devel.x86_64 | ||
|
||
|
||
# Install CUDA 11.4 | ||
#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
#yum install --setopt=obsoletes=0 -y \ | ||
# cuda-nvcc-11-4-11.4.152-1 \ | ||
# cuda-cudart-devel-11-4-11.4.148-1 \ | ||
# libcurand-devel-11-4-10.2.5.120-1 \ | ||
# libcudnn8-devel-8.2.4.15-1.cuda11.4 \ | ||
# libcublas-devel-11-4-11.6.5.2-1 | ||
#ln -s cuda-11.4 /usr/local/cuda | ||
# | ||
#yum install -y python3-devel.x86_64 | ||
|
||
|
||
# Install CUDA 11.6 | ||
# sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf | ||
#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
#yum install --setopt=obsoletes=0 -y \ | ||
# cuda-nvcc-11-6-11.6.124-1 \ | ||
# cuda-cudart-devel-11-6-11.6.55-1 \ | ||
# libcurand-devel-11-6-10.2.9.124-1 \ | ||
# libcudnn8-devel-8.4.1.50-1.cuda11.6 \ | ||
# libcublas-devel-11-6-11.9.2.110-1 | ||
#ln -s cuda-11.6 /usr/local/cuda | ||
|
||
|
||
# Install CUDA 11.8 | ||
# yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
# yum install --setopt=obsoletes=0 -y \ | ||
# cuda-nvcc-11-8-11.8.89-1 \ | ||
# cuda-cudart-devel-11-8-11.8.89-1 \ | ||
# libcurand-devel-11-8-10.3.0.86-1\ | ||
# libcudnn8-devel-8.8.0.121-1.cuda11.8 \ | ||
# libcublas-devel-11-8-11.11.3.6-1 | ||
# ln -s cuda-11.8 /usr/local/cuda | ||
|
||
# yum install -y python3-devel.x86_64 | ||
|
||
# Install CUDA 12.0 | ||
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
yum install --setopt=obsoletes=0 -y \ | ||
cuda-drivers-525.147.05-1.x86_64 \ | ||
cuda-nvcc-12-0-12.0.140-1 \ | ||
cuda-cudart-devel-12-0-12.0.146-1 | ||
ln -s cuda-12.0 /usr/local/cuda | ||
|
||
yum install glibc-devel | ||
|
||
yum install --disableplugin=fastmirror -y python3-devel.x86_64 | ||
|
||
pip_config_dir="${HOME}/.pip" | ||
pip_config_file="${pip_config_dir}/pip.conf" | ||
|
||
mkdir -p "${pip_config_dir}" | ||
|
||
if [[ ! -f "${pip_config_file}" ]]; then | ||
touch "${pip_config_file}" | ||
fi | ||
|
||
echo "[global]" >> "${pip_config_file}" | ||
# echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >> "${pip_config_file}" | ||
echo "index-url = https://pypi.org/simple" >> "${pip_config_file}" | ||
|
||
echo "Pip mirror sources have been set!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[tool.cibuildwheel] | ||
build = "*" | ||
skip = "" | ||
test-skip = "" | ||
|
||
archs = ["auto"] | ||
build-frontend = "pip" | ||
config-settings = {} | ||
dependency-versions = "pinned" | ||
environment = {} | ||
environment-pass = [] | ||
build-verbosity = 1 | ||
|
||
before-all = "" | ||
repair-wheel-command = "" | ||
|
||
test-command = "" | ||
before-test = "" | ||
test-requires = [] | ||
test-extras = [] | ||
|
||
container-engine = "docker" | ||
|
||
manylinux-x86_64-image = "manylinux2014" | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools==68.2.0", | ||
"wheel", | ||
"Cython", | ||
"pybind11", | ||
"setuptools_scm[toml]>=3.4", | ||
"cmake", | ||
"taichi", | ||
] | ||
|
||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
requires-python = ">=3.8, <=3.12" | ||
name = "braintaichi" | ||
version = "0.0.1" | ||
|
||
[tool.cibuildwheel.linux] | ||
before-all = "sh prepare_build_wheel_on_cuda.sh" | ||
before-build = "sh copy_so_linux.sh" | ||
#before-build = "pip install -r requirements-test.txt" | ||
archs = ["x86_64"] | ||
skip = ["pp*", "*-musllinux_x86_64"] | ||
repair-wheel-command = """ | ||
export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && | ||
auditwheel repair -w {dest_dir} {wheel} | ||
""" | ||
|
||
[tool.cibuildwheel.macos] | ||
before-build = "sh copy_so_macOS.sh" | ||
archs = ["x86_64", "arm64"] | ||
skip = ["pp*"] | ||
repair-wheel-command = """ | ||
export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && | ||
delocate-wheel -w {dest_dir} -v {wheel} | ||
""" | ||
|
||
[tool.cibuildwheel.windows] | ||
before-build = "copy_dll_windows.bat" | ||
archs = ["AMD64", "x86"] | ||
repair-wheel-command = """ | ||
set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} | ||
""" | ||
skip = ["pp*", "*-win32"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import taichi as ti | ||
import glob | ||
import shutil | ||
import subprocess | ||
import os | ||
|
||
taichi_path = ti.__path__[0] | ||
taichi_c_api_install_dir = os.path.join(taichi_path, '_lib', 'c_api') | ||
|
||
taichi_runtime_lib = os.path.join(taichi_c_api_install_dir, 'lib') | ||
|
||
taichi_runtime_lib = os.path.realpath(taichi_runtime_lib) | ||
if not os.path.exists(taichi_runtime_lib): | ||
taichi_runtime_lib = os.path.join(taichi_c_api_install_dir, 'lib64') | ||
taichi_runtime_lib = os.path.realpath(taichi_runtime_lib) | ||
if not os.path.exists(taichi_runtime_lib): | ||
taichi_runtime_lib = os.path.join(taichi_c_api_install_dir, 'bin') | ||
taichi_runtime_lib = os.path.realpath(taichi_runtime_lib) | ||
|
||
|
||
taichi_lib_target_dir ='project/brainpylib' | ||
|
||
env_script_path = '/project/set_env.sh' | ||
# if not os.path.isfile(env_script_path): | ||
# os.mknod(env_script_path) | ||
|
||
with open(env_script_path, 'w') as env_script: | ||
env_script.write(f'export taichi_lib_target_dir="{taichi_lib_target_dir}"\n') | ||
env_script.write(f'export taichi_runtime_lib_dir="{taichi_runtime_lib}"\n') | ||
|
||
print(f"Environment setup script created at {env_script_path}") | ||
|
||
# so_files = glob.glob(os.path.join(taichi_runtime_lib, '*.so')) | ||
# for so_file in so_files: | ||
# subprocess.check_call(['cp', '-v', so_file, taichi_lib_target_dir]) | ||
|
||
# for lib in glob.glob(os.path.join(taichi_runtime_lib, '*.so')): | ||
# shutil.copy(lib, taichi_lib_target_dir) | ||
# print('cp {} {}'.format(lib, taichi_lib_target_dir)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#! /bin/sh | ||
|
||
pip install taichi | ||
chmod +x ./copy_so_linux.py | ||
python copy_so_linux.py | ||
|
||
# Ensure the set_env.sh script is actually created and is not empty | ||
dir /project | ||
if [ -s set_env.sh ]; then | ||
source /project/set_env.sh | ||
cp "$taichi_runtime_lib_dir"/libtaichi_c_api.so /project/brainpylib/ | ||
else | ||
echo "Environment setup script 'set_env.sh' is missing or empty." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters