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

Try building a non-ABI version of liblantern #538

Open
wants to merge 8 commits into
base: main
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
39 changes: 37 additions & 2 deletions .github/workflows/lantern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
- 'cran/**'
- re-add-cuda10.1
- non-abi

jobs:
build:
Expand Down Expand Up @@ -41,6 +41,19 @@ jobs:
flavor: Release
artifacts: liblantern.so
upload: Linux
- os: ubuntu-18.04
cuda: -1
library: liblantern.so
test: ./lanterntest
make: make
build: build
cmakevars: -D_GLIBCXX_USE_CXX11_ABI=0
libext:
exeext:
fixlib: chrpath -r '$ORIGIN/.' liblantern.so
flavor: Release
artifacts: liblantern.so
upload: LinuxNonABI
- os: macos-10.15
cuda: 0
library: liblantern.dylib
Expand All @@ -67,6 +80,19 @@ jobs:
flavor: Release
artifacts: liblantern.so
upload: Linux-Cuda-101
- os: ubuntu-18.04
cuda: 10.1
library: liblantern.so
test: ./lanterntest
make: make
build: build
cmakevars: -D_GLIBCXX_USE_CXX11_ABI=0
libext:
exeext:
fixlib: chrpath -r '$ORIGIN/.' liblantern.so
flavor: Release
artifacts: liblantern.so
upload: LinuxNonABI-Cuda-101
- os: ubuntu-18.04
cuda: 10.2
library: liblantern.so
Expand Down Expand Up @@ -243,7 +269,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
name: [macOS, Linux, Windows, Cuda101, Cuda102, Cuda111, WindowsCuda101, WindowsCuda102, WindowsCuda111]
name: [macOS, Linux, LinuxNonABI, Windows, Cuda101, NonABICuda101, Cuda102, Cuda111, WindowsCuda101, WindowsCuda102, WindowsCuda111]
include:
- name: macOS
artifact: macOS
Expand All @@ -253,6 +279,10 @@ jobs:
artifact: Linux
upload: Linux
hw: cpu
- name: LinuxNonABI
artifact: LinuxNonABI
upload: LinuxNonABI
hw: cpu
- name: Windows
artifact: Windows
upload: Windows
Expand All @@ -262,6 +292,11 @@ jobs:
upload: Linux
hw: gpu
version: -101
- name: NonABICuda101
artifact: LinuxNonABI-Cuda-101
upload: LinuxNonABI
hw: gpu
version: -101
- name: Cuda102
artifact: Linux-Cuda-102
upload: Linux
Expand Down
30 changes: 27 additions & 3 deletions lantern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ cmake_minimum_required(VERSION 3.16)

project(lantern)


if(NOT DEFINED _GLIBCXX_USE_CXX11_ABI)
set(_GLIBCXX_USE_CXX11_ABI 1)
endif()
message("-- _GLIBCXX_USE_CXX11_ABI=${_GLIBCXX_USE_CXX11_ABI}")

add_definitions(-D_GLIBCXX_USE_CXX11_ABI=${_GLIBCXX_USE_CXX11_ABI})

############################################################
# Helpers
############################################################
Expand Down Expand Up @@ -54,17 +62,33 @@ elseif(UNIX)
message(FATAL_ERROR, "CUDA 9.2 is no longer supported")
elseif(DEFINED ENV{CUDA} AND '$ENV{CUDA}' STREQUAL '10.1')
add_compile_definitions(CUDA101)
retrieve_lib("https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcu101.zip" "libtorch")
if ('${_GLIBCXX_USE_CXX11_ABI}' STREQUAL '1')
retrieve_lib("https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcu101.zip" "libtorch")
else()
retrieve_lib("https://download.pytorch.org/libtorch/cu101/libtorch-shared-with-deps-1.8.0%2Bcu101.zip" "libtorch")
endif()
elseif(DEFINED ENV{CUDA} AND '$ENV{CUDA}' STREQUAL '10.2')
add_compile_definitions(CUDA102)
retrieve_lib("https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu102.zip" "libtorch")
if ('${_GLIBCXX_USE_CXX11_ABI}' STREQUAL '1')
retrieve_lib("https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu102.zip" "libtorch")
else()
retrieve_lib("https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.8.1%2Bcu102.zip" "libtorch")
endif()
elseif(DEFINED ENV{CUDA} AND '$ENV{CUDA}' STREQUAL '11.0')
message(FATAL_ERROR, "CUDA 11.0 is no longer supported")
elseif(DEFINED ENV{CUDA} AND '$ENV{CUDA}' STREQUAL '11.1')
add_compile_definitions(CUDA111)
retrieve_lib("https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu111.zip" "libtorch")
if ('${_GLIBCXX_USE_CXX11_ABI}' STREQUAL '1')
retrieve_lib("https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu111.zip" "libtorch")
else()
retrieve_lib("https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.1%2Bcu111.zip" "libtorch")
endif()
else()
if ('${_GLIBCXX_USE_CXX11_ABI}' STREQUAL '1')
retrieve_lib("https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcpu.zip" "libtorch")
else()
retrieve_lib("https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.8.1%2Bcpu.zip" "libtorch")
endif()
endif()
else()
message(FATAL_ERROR, "OS not supported.")
Expand Down