Skip to content

Commit

Permalink
Minify the library to a stub, to start building it for arm64 using Qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Dec 4, 2024
1 parent 6f79c5e commit dd32d1d
Show file tree
Hide file tree
Showing 373 changed files with 18 additions and 19,845 deletions.
199 changes: 2 additions & 197 deletions .github/workflows/build-test-gha-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,14 @@ jobs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8', '3.13']
python_version: ['3.8']
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip${{ matrix.python_version }} install build auditwheel twine Chrones
- name: Install CUDA
run: |
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt-get update
sudo apt-get install --yes --no-install-recommends cuda-cudart-dev-12-4 cuda-nvcc-12-4
echo "/usr/local/cuda-12.4/bin" >>$GITHUB_PATH
- name: Install Boost
run: |
cd /home/runner/work
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
cd boost_*
sudo cp -r boost /usr/local/include
- name: Install OR-Tools
run: |
cd /home/runner/work
wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_amd64_ubuntu-20.04_cpp_v9.11.4210.tar.gz
tar xf or-tools_*.tar.gz
rm or-tools_*.tar.gz
cd or-tools_*
sudo cp -r include/* /usr/local/include
sudo cp -r lib/* /usr/local/lib
sudo ldconfig
- name: Install patchelf
run: |
cd /home/runner/work
Expand All @@ -86,9 +61,6 @@ jobs:
- name: Build the wheel
run: python${{ matrix.python_version }} -m build --wheel --outdir local-dist lincs-*
env:
LINCS_DEV_FORCE_NVCC: "true"
LINCS_DEV_FORCE_CHRONES: "true"
- name: Make the wheel machine-independent
run: auditwheel repair --plat manylinux_2_31_x86_64 --strip local-dist/*.whl --wheel-dir dist
- name: Check the wheel
Expand All @@ -100,178 +72,16 @@ jobs:
name: wheel-dist-${{ matrix.python_version }}-linux
path: dist

build-for-windows:
runs-on: windows-2022
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8', '3.13']
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip install build delvewheel twine
- name: Install CUDA
uses: Jimver/[email protected]
id: cuda-toolkit
with:
cuda: '12.4.1'
use-github-cache: false
use-local-cache: false
method: network
# Package names from https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#id2
sub-packages: '["nvcc", "cudart"]'
- name: Install MSys2
uses: msys2/setup-msys2@v2
with:
update: true
msystem: UCRT64
install: >-
gzip
tar
unzip
wget
- name: Install boost
shell: msys2 {0}
run: |
cd /d/a
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
mv boost_* boost
cd boost
mkdir -p /d/lincs-deps/include /d/lincs-deps/lib
cp -r boost /d/lincs-deps/include
- name: Install OR-Tools
shell: msys2 {0}
run: |
cd /d/a
wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_x64_VisualStudio2022_cpp_v9.11.4210.zip
unzip or-tools_*.zip
rm or-tools_*.zip
cd or-tools_*
cp -r include/* /d/lincs-deps/include
cp -r lib/* /d/lincs-deps/lib
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
- name: Unzip the source distribution
shell: msys2 {0}
run: |
tar xf *.tar.gz
rm *.tar.gz
- name: Build the wheel
run: python -m build --wheel --outdir local-dist (get-item lincs-*)
env:
LINCS_DEV_FORCE_NVCC: "true"
LINCS_DEV_DEPENDENCIES: d:\lincs-deps
- name: Make the wheel machine-independent
run: delvewheel repair --strip (get-item local-dist\*.whl) --wheel-dir dist --add-path d:\lincs-deps\lib
- name: Check the wheel
run: twine check (get-item dist\*.whl)

- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-windows
path: dist

build-for-macos:
runs-on: macos-13
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8', '3.13']
env:
MACOSX_DEPLOYMENT_TARGET: 12.0
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip3 install build delocate twine
- name: Install OpenMP
run: |
cd /Users/runner/work
mkdir openmp
cd openmp
wget https://mac.r-project.org/openmp/openmp-16.0.4-darwin20-Release.tar.gz
tar xf *.tar.gz
sudo cp usr/local/lib/* /usr/local/lib
sudo cp usr/local/include/* /usr/local/include
- name: Install Boost
run: |
cd /Users/runner/work
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
cd boost_*
sudo cp -r boost /usr/local/include
- name: Install OR-Tools
run: |
cd /Users/runner/work
wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_x86_64_macOS-14.6.1_cpp_v9.11.4210.tar.gz
tar xf or-tools_x86_64_*.tar.gz
rm or-tools_x86_64_*.tar.gz
wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_arm64_macOS-14.6.1_cpp_v9.11.4210.tar.gz
tar xf or-tools_arm64_*.tar.gz
rm or-tools_arm64_*.tar.gz
sudo cp -r or-tools_arm64_*/include/* /usr/local/include
lipo or-tools*/lib/libortools.9.11.dylib -output /usr/local/lib/libortools.9.11.dylib -create
cd /usr/local/lib
ln -s libortools.9.11.dylib libortools.9.dylib
ln -s libortools.9.dylib libortools.dylib
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
- name: Unzip the source distribution
run: |
tar xf *.tar.gz
rm *.tar.gz
- name: Build the wheel
run: python3 -m build --wheel --outdir local-dist lincs-*
- name: Make the wheel machine-independent
run: delocate-wheel --wheel-dir dist local-dist/*.whl
- name: Check the wheel
run: twine check dist/*.whl

- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-macos
path: dist

check:
runs-on: ${{ matrix.os }}
needs:
- build-for-linux
- build-for-windows
- build-for-macos
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- windows-2019
- windows-2022
- macos-12
- macos-13
- macos-14
- macos-15
python_version: ['3.8', '3.13']
python_version: ['3.8']
exclude:
# Older Python versions don't build 'universal2' wheels, so they can't run on the M1 runner that run macOS 14 and 15
- os: macos-14
Expand Down Expand Up @@ -304,8 +114,3 @@ jobs:

- name: Run lincs
run: lincs --help
- run: lincs generate classification-problem 3 2 --output-problem problem.yml
- run: lincs generate classification-model problem.yml --output-model model.yml
- run: lincs generate classified-alternatives problem.yml model.yml 100 --output-alternatives learning-set.csv
- run: lincs learn classification-model problem.yml learning-set.csv --output-model learned-model.yml
- run: lincs classification-accuracy problem.yml learned-model.yml learning-set.csv
12 changes: 6 additions & 6 deletions doc-sources/get-started/get-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}
],
"source": [
"lincs generate classification-problem 4 3 --output-problem problem.yml\n",
"lincs generate classification-problem 4 3 --output-problem problem.yml --random-seed 40\n",
"cat problem.yml"
]
},
Expand Down Expand Up @@ -147,7 +147,7 @@
}
],
"source": [
"lincs generate classification-model problem.yml --output-model model.yml\n",
"lincs generate classification-model problem.yml --output-model model.yml --random-seed 41\n",
"cat model.yml"
]
},
Expand Down Expand Up @@ -222,7 +222,7 @@
}
],
"source": [
"lincs generate classified-alternatives problem.yml model.yml 1000 --output-alternatives learning-set.csv\n",
"lincs generate classified-alternatives problem.yml model.yml 1000 --output-alternatives learning-set.csv --random-seed 42\n",
"head -n 7 learning-set.csv"
]
},
Expand Down Expand Up @@ -281,7 +281,7 @@
}
],
"source": [
"lincs learn classification-model problem.yml learning-set.csv --output-model trained-model.yml\n",
"lincs learn classification-model problem.yml learning-set.csv --output-model trained-model.yml --mrsort.weights-profiles-breed.accuracy-heuristic.random-seed 43\n",
"cat trained-model.yml"
]
},
Expand All @@ -296,7 +296,7 @@
},
"outputs": [],
"source": [
"lincs generate classified-alternatives problem.yml model.yml 3000 --output-alternatives testing-set.csv"
"lincs generate classified-alternatives problem.yml model.yml 3000 --output-alternatives testing-set.csv --random-seed 44\n"
]
},
{
Expand Down Expand Up @@ -335,7 +335,7 @@
],
"source": [
"lincs classify problem.yml trained-model.yml testing-set.csv --output-alternatives reclassified-testing-set.csv\n",
"diff testing-set.csv reclassified-testing-set.csv"
"diff testing-set.csv reclassified-testing-set.csv | tail -n +5\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
],
"source": [
"lincs learn classification-model problem.yml learning-set.csv \\\n",
" --mrsort.weights-profiles-breed.linear-program.solver alglib"
" --mrsort.weights-profiles-breed.linear-program.solver alglib --mrsort.weights-profiles-breed.accuracy-heuristic.random-seed 43\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion doc-sources/user-guide/gpu-learning/gpu-learning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
],
"source": [
"lincs learn classification-model problem.yml learning-set.csv \\\n",
" --mrsort.weights-profiles-breed.accuracy-heuristic.processor gpu"
" --mrsort.weights-profiles-breed.accuracy-heuristic.processor gpu --mrsort.weights-profiles-breed.accuracy-heuristic.random-seed 43\n"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions doc-sources/user-guide/synthetic-data/synthetic-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
],
"source": [
"lincs generate classification-problem 4 3"
"lincs generate classification-problem 4 3 --random-seed 57 | tee problem.yml\n"
]
},
{
Expand Down Expand Up @@ -84,7 +84,7 @@
}
],
"source": [
"lincs generate classification-model problem.yml"
"lincs generate classification-model problem.yml --random-seed 58 | tee model.yml\n"
]
},
{
Expand Down Expand Up @@ -207,7 +207,7 @@
}
],
"source": [
"lincs generate classified-alternatives problem.yml model.yml 100"
"lincs generate classified-alternatives problem.yml model.yml 100 --random-seed 59 | tee learning-set.csv\n"
]
},
{
Expand Down Expand Up @@ -245,7 +245,7 @@
}
],
"source": [
"lincs learn classification-model problem.yml learning-set.csv"
"lincs learn classification-model problem.yml learning-set.csv --mrsort.weights-profiles-breed.accuracy-heuristic.random-seed 60\n"
]
}
],
Expand Down
26 changes: 1 addition & 25 deletions lincs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@
It contains general information (version, GPU availability, *etc.*) and items of general usage (*e.g.* the exception for invalid data).
"""

# General exceptions
from liblincs import DataValidationException, LearningFailureException

# General utilities
from liblincs import UniformRandomBitsGenerator

# Classification
from . import classification

# General information
__version__ = "2.0.0a7.dev0"
has_gpu = hasattr(classification, "ImproveProfilesWithAccuracyHeuristicOnGpu")

try:
del visualization
except NameError:
pass

try:
del description
except NameError:
pass

try:
del command_line_interface
except NameError:
pass
has_gpu = False
Loading

0 comments on commit dd32d1d

Please sign in to comment.