Skip to content

Commit f3c51c5

Browse files
committed
Improve documentation, update workflows
1 parent af923e5 commit f3c51c5

File tree

8 files changed

+182
-74
lines changed

8 files changed

+182
-74
lines changed

.github/workflows/docs.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,35 @@ on:
44
push:
55
branches:
66
- main
7-
- gpu_branch
87
- final_project
98

109
pull_request:
1110
branches:
1211
- main
1312
- final_project
14-
- gpu_branch
1513

1614
jobs:
1715
docs:
1816
name: Documentation
1917
runs-on: ubuntu-latest
20-
container:
21-
image: cupy/cupy:v13.4.0
2218

2319
steps:
2420
- uses: actions/checkout@v3
2521

2622
- name: Clean previous builds
2723
run: rm -rf build dist *.egg-info
2824

29-
- name: Set up git
30-
run: apt-get update && apt-get install git -y
31-
3225
- name: Install system dependencies
3326
run: |
34-
apt-get update && apt-get install -y python3-venv python3-pip
27+
sudo apt-get update
28+
sudo apt-get install -y python3.12 python3.12-venv python3-pip git
3529
36-
- name: Install additional dependencies
30+
- name: Create virtual environment and install package
3731
run: |
38-
python3.10 -m venv venv
32+
python3.12 -m venv venv
3933
source venv/bin/activate
40-
python3.10 -m pip install --no-cache-dir .
34+
python3.12 -m pip install --upgrade pip
35+
python3.12 -m pip install --no-cache-dir .
4136
shell: bash -e {0}
4237

4338
- name: Generate documentation
@@ -46,7 +41,7 @@ jobs:
4641
cd docs
4742
make html
4843
shell: bash -e {0}
49-
44+
5045
- name: Deploy
5146
if: success()
5247
uses: peaceiris/actions-gh-pages@v3

.github/workflows/tests.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,44 @@ on:
1616

1717
jobs:
1818
test:
19-
name: Testing using pytest
19+
name: Testing on Python ${{ matrix.python-version }}
2020
runs-on: ubuntu-latest
21-
container:
22-
image: cupy/cupy:v13.4.0
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ['3.10', '3.11', '3.12']
2326

2427
steps:
2528
- uses: actions/checkout@v3
2629

30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
2735
- name: Clean previous builds
2836
run: rm -rf build dist *.egg-info
2937

3038
- name: Install system dependencies
3139
run: |
32-
apt-get update && apt-get install -y python3.10-venv python3-pip cmake
40+
sudo apt-get update
41+
sudo apt-get install -y cmake
3342
34-
- name: Install additional dependencies
43+
- name: Install Python dependencies
3544
run: |
36-
python3.10 -m venv venv
45+
python -m venv venv
3746
source venv/bin/activate
38-
python3.10 -m pip install --no-cache-dir .
39-
shell: bash -e {0}
47+
python -m pip install --upgrade pip
48+
pip install pybind11
49+
pip install --no-cache-dir .
50+
shell: bash
4051

41-
- name: Test with pytest
52+
- name: Run tests with pytest
4253
run: |
4354
source venv/bin/activate
4455
mkdir -p build
4556
cmake -B build -S .
46-
cd build
47-
make
48-
cd ..
49-
python3.10 -m pytest
50-
shell: bash -e {0}
57+
cmake --build build
58+
pytest
59+
shell: bash

CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ execute_process(
1717
OUTPUT_STRIP_TRAILING_WHITESPACE
1818
)
1919
set(CMAKE_PREFIX_PATH ${PYBIND11_CMAKE_DIR})
20-
find_package(pybind11 REQUIRED)
20+
21+
22+
execute_process(
23+
COMMAND "${PYTHON_EXECUTABLE}" -m pybind11 --cmakedir
24+
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
)
27+
28+
list(APPEND CMAKE_PREFIX_PATH "${PYBIND11_CMAKE_DIR}")
29+
find_package(pybind11 REQUIRED CONFIG)
2130

2231
# Needed for compilation (again, Ulysses... :/ )
2332
set(CMAKE_CXX_STANDARD 17)
@@ -30,4 +39,4 @@ pybind11_add_module(QR_cpp ${CMAKE_SOURCE_DIR}/src/pyclassify/QR_bindings.cpp)
3039
set_target_properties(QR_cpp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
3140

3241
target_compile_features(QR_cpp PUBLIC cxx_std_17)
33-
install(TARGETS QR_cpp LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/src/pyclassify)
42+
install(TARGETS QR_cpp LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/src/pyclassify)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ TO DO:
1212
4) Accuracy vs efficiency
1313
5) Script to run on Ulysses
1414
6) Add missing tests
15+
7) Possibly delete eigenvalues\_np and so on, which I inserted because I thought it was not going to be necessary to compute the eigenvectors, making these wrappers useless
16+
8) Write missing documentation

docs/index.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ final_project documentation
77
===========================
88

99
Welcome to the documentation for the final project of the course in Development Tools for Scientific Computing.
10-
We are currently working on the project and on the documentation.
11-
Stay tuned!
10+
Our goal is to compute an efficient solver for eigenvalue problems.
1211

13-
Recall that the documentation is written following
14-
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
12+
For theoretical details, please check the file docs/Documentation.ipynb
13+
To install the package, please read the README.md file.
1514

1615

1716
Table of Contents
@@ -30,4 +29,4 @@ Module Documentation
3029
:members:
3130
:undoc-members:
3231
:show-inheritance:
33-
:noindex:
32+
:noindex:

docs/pyclassify.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ Submodule: utils
1717
.. automodule:: pyclassify.utils
1818
:members:
1919
:undoc-members:
20-
:show-inheritance:
20+
:show-inheritance:
21+
22+
Submodule: helpers_secular
23+
================
24+
25+
.. automodule:: pyclassify.helpers_secular
26+
:members:
27+
:undoc-members:
28+
:show-inheritance:
29+

setup.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import shutil
4+
import glob
45
from setuptools import setup, find_packages, Extension
56
from setuptools.command.build_ext import build_ext
67

@@ -21,22 +22,19 @@ def build_extension(self, ext):
2122
self.spawn(["cmake", ext.sourcedir, "-B", build_temp])
2223
self.spawn(["cmake", "--build", build_temp, "--target", "QR_cpp"])
2324

24-
python_version = sys.version_info
25-
so_filename = (
26-
f"QR_cpp.cpython-{python_version[0]}{python_version[1]}-x86_64-linux-gnu.so"
27-
)
28-
29-
src_lib = os.path.join(build_temp, f"../../src/pyclassify/{so_filename}")
30-
dst_lib = os.path.join(build_lib, f"pyclassify/{so_filename}")
31-
32-
if os.path.exists(src_lib):
33-
os.makedirs(os.path.dirname(dst_lib), exist_ok=True)
34-
shutil.copy(src_lib, dst_lib)
35-
else:
25+
# Dynamically find the compiled shared library
26+
matches = glob.glob(os.path.join(build_temp, "../../src/pyclassify/QR_cpp*.so"))
27+
if not matches:
3628
raise RuntimeError(
37-
f"Could not find compiled QR_cpp shared library at {src_lib}!"
29+
"Could not find compiled QR_cpp shared library in expected location."
3830
)
3931

32+
src_lib = os.path.abspath(matches[0])
33+
dst_lib = os.path.join(build_lib, "pyclassify", os.path.basename(src_lib))
34+
35+
os.makedirs(os.path.dirname(dst_lib), exist_ok=True)
36+
shutil.copy(src_lib, dst_lib)
37+
4038

4139
setup(
4240
name="pyclassify",
@@ -48,7 +46,7 @@ def build_extension(self, ext):
4846
ext_modules=[CMakeExtension("pyclassify.QR_cpp")],
4947
packages=find_packages(where="src/"),
5048
package_dir={"": "src/"},
51-
package_data={"pyclassify": ["QR_cpp.cpython-312-x86_64-linux-gnu.so"]},
49+
package_data={"pyclassify": ["QR_cpp*.so"]},
5250
include_package_data=True,
5351
cmdclass={"build_ext": CMakeBuild},
5452
zip_safe=False,

0 commit comments

Comments
 (0)