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

Update peer to compile and work on modern platforms. #1

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
86b612e
Initial exploration: Updating peer to work in modern environments.
pettyalex Mar 5, 2024
9ad7518
Get peer building on a modern system, R libraries included
pettyalex Mar 5, 2024
3991939
Update alglib to 4.01.0
pettyalex Mar 5, 2024
3ba56b8
Add conda env for github action
pettyalex Mar 5, 2024
b6896f2
Manually point cmake at the conda dir?
pettyalex Mar 5, 2024
6cb14f2
Actually lets see everything
pettyalex Mar 5, 2024
f84d0ab
it only works with bash
pettyalex Mar 5, 2024
bf3de1a
Fix up SWIG / R to put generated files in a specified place.
pettyalex Mar 6, 2024
036d93e
Get the dest paths for swig correct.
pettyalex Mar 6, 2024
51eb82d
Check a vendored eigen back in. Fix standalone package build for R an…
pettyalex Mar 6, 2024
76a994a
R CMD build is lower case. Also remove unintentionally checked in bin…
pettyalex Mar 6, 2024
c67437b
Fixup R package build and move whole thing into the script.
pettyalex Mar 6, 2024
039f0ec
Add python-build to the conda environment
pettyalex Mar 6, 2024
56f5238
Check in empty src dir in the template via gitignore. We could also s…
pettyalex Mar 6, 2024
5fb3b6e
Add another build step to try cibuildwheel on the python packages.
pettyalex Mar 7, 2024
ada9ac4
Fix matrix build
pettyalex Mar 7, 2024
fc6c3e3
Replace alglib with boost
pettyalex Mar 7, 2024
cc9a7da
Add boost to the conda environment we're building in
pettyalex Mar 14, 2024
195d1b7
Try compiling with boost and eigen from repo or conda env
pettyalex Mar 14, 2024
6f3dfc6
Remove vendored alglib, fix path in wheel / r build
pettyalex Mar 14, 2024
05d22ce
Fix paths in github actions build. Dont copy in description from R dir
pettyalex Mar 14, 2024
813c3b5
Correct python standalone build. Add a script to build and install bo…
pettyalex Mar 14, 2024
c35b652
Github actions calls it arm64 on mac os
pettyalex Mar 14, 2024
bc150e4
Remove extraneous R data artifacts.
pettyalex Mar 14, 2024
73dfe52
Add minimum python 3.7
pettyalex Mar 14, 2024
9ef666b
Install boost in cibuildwheel job
pettyalex Mar 14, 2024
d14fd2c
Specify boost version
pettyalex Mar 14, 2024
7c4d614
Go ahead and vendor boost::math. Maybe this is a bad idea?
pettyalex Mar 14, 2024
8035e40
Marked python package version 2.0
pettyalex Mar 15, 2024
8754c95
Work towards a standalone R package build without Cmake
pettyalex Mar 15, 2024
11af5be
Create python package specifically for conda forge install
pettyalex Mar 15, 2024
ebcc9de
Fix quote on R build. Do not build wheels for conda-forge
pettyalex Mar 15, 2024
385d681
Point R install at right directory
pettyalex Mar 15, 2024
5ad099e
Update to R 4.3.3 for github build
pettyalex Mar 15, 2024
a0d453c
Fixup actions to use checkout v4, rename jobs for more clarity.
pettyalex Mar 15, 2024
4a70112
R build correctly target package
pettyalex Mar 15, 2024
2fd47ca
skip windows build for now
pettyalex Mar 15, 2024
64e6301
Fix missing include into boost math digamma, fix compile flag so that…
pettyalex Mar 15, 2024
7057195
OK, no windows for now
pettyalex Mar 15, 2024
ad3018f
Include LICENSE in R and python packages.
pettyalex Mar 27, 2024
b198887
Remove incomplete standalone dir. We're going to distribute via conda…
pettyalex Mar 27, 2024
6b64767
Cleanup scripts to generate r and python packages.
pettyalex Mar 27, 2024
f85cc81
Install R deps before testing built R package
pettyalex Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 37 additions & 0 deletions .github/workflows/build-python-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Package Python

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
mamba-version: "*"
channel-priority: true
activate-environment: peer
environment-file: peer-environment.yml

- name: Assemble Python source package
run: |
pushd conda_forge_python
bash create_python_package.sh
popd

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-package
path: conda_forge_python/peer/dist/peer-*.tar.gz
65 changes: 65 additions & 0 deletions .github/workflows/build-r-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Package R

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
mamba-version: "*"
channel-priority: true
activate-environment: peer
environment-file: peer-environment.yml

- name: Assemble R source package
run: |
pushd cran
bash package_r_only.sh
popd

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: r-package
path: cran/peer_*.tar.gz

r-cran-install:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
needs: build
steps:
- name: Download package
uses: actions/download-artifact@v4
with:
name: r-package

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.3' # The R version to download (if necessary) and use.
# Use "renv" to retrieve R version recorded in renv.lock file.

- name: Install R dependencies
run: Rscript -e 'install.packages(c("BH", "RcppEigen"))'

- name: Install R package
run: R CMD INSTALL peer_2.0.tar.gz
100 changes: 100 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Package and compile Peer across OSes and archs

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
mamba-version: "*"
channel-priority: true
activate-environment: peer
environment-file: peer-environment.yml

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Assemble R source package
run: |
pushd cran
bash create_source_new.sh
popd

- name: Assemble Python source package
run: |
pushd standalone_python
bash create_python_package.sh
popd

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: peertool
path: build/src/peertool

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: r-python-packages
path: |
cran/peer_*.tar.gz
standalone_python/peer/dist/peer-*.tar.gz

cibuildwheel:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: r-python-packages

- name: cibuildwheel for python
uses: pypa/[email protected]
with:
package-dir: standalone_python/peer/dist/peer-2.0.0.tar.gz
env:
CIBW_ARCHS_MACOS: x86_64 arm64

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

- name: Set up R
uses: r-lib/actions/setup-r@v2
- run: Rscript -e 'install.packages("BH", "RccpEigen")'

- name: Test R on this platform
run: R CMD check --as-cran cran/peer_2.0.tar.gz
29 changes: 20 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
build/*
CMakeFiles/*
cran/peer/DESCRIPTION
cran/peer/NAMESPACE
cran/peer/R
cran/peer/man
cran/peer/src/*.cpp
cran/peer/src/*.so
cran/peer/src/*.h
cran/peer_source.tgz
cran/peer/src/alglib
cran/peer/
cran/*.tar.gz

*.Rcheck

# Editor
.vscode/

# Built python package
standalone_python/peer
conda_forge_python/peer
python/peer.py
python/peerPYTHON_wrap.cxx

# Generated by swig. Should these go into the bin dir?
R/peer.R
R/peerR_wrap.cxx

# Mac hidden dirs
.DS_Store
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.20)
project(PEER)
set(CMAKE_CXX_STANDARD 14)

#build options
#bindings
#PYTHON on by default
option(BUILD_PYTHON_PACKAGE "Enable Python bindings" ON)
#R optional
option(BUILD_R_PACKAGE "Enable R bindings" OFF)
option(BUILD_R_PACKAGE "Enable R bindings" ON)

#build stuff
option(BUILD_UNIVERSAL "Build both 32 and 64 bit versions" OFF)
Expand Down Expand Up @@ -74,6 +75,12 @@ endif (BUILD_UNIVERSAL)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})

find_package(Eigen3 REQUIRED NO_MODULE)
link_libraries(Eigen3::Eigen)

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_SWIG_FLAGS "")

Expand All @@ -85,12 +92,10 @@ add_definitions(-g -Wextra -D_BSD_SOURCE)
#fPic while compiling on
#this seems to be needed on some linux systems
#set(CMAKE_CXX_FLAGS "-fPIC -O3 -march=core2")
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_CXX_FLAGS "-fPIC -O3")

include_directories(./External/alglib/src)

#add Cmake modules
add_subdirectory(./External/alglib/src)
add_subdirectory(./External/csv_parser)
add_subdirectory(./src)

Expand Down
1 change: 0 additions & 1 deletion External/Eigen

This file was deleted.

4 changes: 0 additions & 4 deletions External/Eigen-3.1.0-alpha2/.hg_archival.txt

This file was deleted.

8 changes: 0 additions & 8 deletions External/Eigen-3.1.0-alpha2/.hgeol

This file was deleted.

32 changes: 0 additions & 32 deletions External/Eigen-3.1.0-alpha2/.hgignore

This file was deleted.

18 changes: 0 additions & 18 deletions External/Eigen-3.1.0-alpha2/.hgtags

This file was deleted.

3 changes: 0 additions & 3 deletions External/Eigen-3.1.0-alpha2/.krazy

This file was deleted.

Loading
Loading