Skip to content

Commit b7ced97

Browse files
committed
release fix 2
1 parent fce92b4 commit b7ced97

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,31 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14+
# Build on all 3 OSs
1415
os: [ubuntu-latest, windows-latest, macos-latest]
1516

1617
steps:
1718
- uses: actions/checkout@v4
1819

19-
# Build the wheels
2020
- name: Build wheels
2121
uses: pypa/[email protected]
2222
env:
23-
# Skip old Python versions and PyPy to save time
23+
# Skip old Python versions
2424
CIBW_SKIP: "cp36-* cp37-* cp38-* pp*"
25-
# Force C++20 standard for Linux builds (Nanobind needs it)
25+
26+
# Linux: Force C++20
2627
CIBW_ENVIRONMENT_LINUX: "CXXFLAGS='-std=c++20'"
27-
28-
- uses: actions/upload-artifact@v4
29-
with:
30-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
31-
path: ./wheelhouse/*.whl
28+
29+
# macOS: Install OpenMP (libomp) before building
30+
CIBW_BEFORE_ALL_MACOS: "brew install libomp"
31+
32+
# macOS: Tell CMake where to find OpenMP
33+
# (Homebrew puts it in a weird spot, we need to point to it)
34+
CIBW_ENVIRONMENT_MACOS: >
35+
CFLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include"
36+
CXXFLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include"
37+
LDFLAGS="-L$(brew --prefix libomp)/lib -lomp"
38+
OpenMP_ROOT="$(brew --prefix libomp)"
3239
3340
build_sdist:
3441
name: Build source distribution

src/CSR.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ inline std::span<size_t> CSR::get_edges(size_t nodeId){
8585
}
8686

8787
inline void CSR::set_access_pattern(bool isRandom){
88-
#ifndef _WIN32
88+
#ifdef __linux__
8989
if(isRandom){
9090
madvise(this->nnzRow,this->sizeofnnzRow,MADV_RANDOM);
9191
madvise(this->colPtr,this->sizeofcolPtr,MADV_RANDOM);
9292
}else{
9393
madvise(this->nnzRow,this->sizeofcolPtr,MADV_SEQUENTIAL);
9494
madvise(this->colPtr,this->sizeofcolPtr,MADV_SEQUENTIAL);
9595
}
96-
#endif // linux
96+
#endif // linux only, no mac/windows
9797
}
9898

9999
#endif

src/MemoryMap.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ inline MemoryMap::MemoryMap(const char* path){
8080

8181
CloseHandle(hMap);
8282
CloseHandle(hFile);
83-
84-
#else // linux
83+
#else // linux/mac
8584
if((fd = open(path,O_RDONLY)) == -1){
8685
throw std::runtime_error("File open failed");
8786
}
@@ -97,8 +96,10 @@ inline MemoryMap::MemoryMap(const char* path){
9796
throw std::runtime_error("mmap failed");
9897
}
9998

100-
// memory advise to use huge pages
101-
madvise(mappedptr,length, MADV_HUGEPAGE);
99+
// Only use Huge Pages on Linux. macOS don't support this flag.
100+
#ifdef __linux__
101+
madvise(mappedptr, length, MADV_HUGEPAGE);
102+
#endif
102103

103104
#endif
104105

0 commit comments

Comments
 (0)