diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 017af7cb..06dd8455 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -18,25 +18,28 @@ jobs:
fetch-tags: true
- name: Script
run: |
- docker run --rm -i -v "$GITHUB_WORKSPACE:/workspace" -w /workspace ubuntu:22.04 bash -s <<'EOF'
+ docker run --rm -i -v "$GITHUB_WORKSPACE:/workspace" -w /workspace centos:7 bash -s <<'EOF'
set -e -o pipefail
- apt-get update -y
- apt-get install -y build-essential git ocl-icd-opencl-dev
+ sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
+ # yum update -y
+ yum install -y centos-release-scl epel-release
+ sed -i -e '/^mirrorlist/d;/^# *baseurl=/{s,^# *,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
+ yum install -y devtoolset-11-gcc-c++ devtoolset-11-libstdc++-static make git ocl-icd-devel
+
+ source /opt/rh/devtoolset-11/enable
g++ --version
+ ldd --version
- make -O -j "$(nproc)"
+ make STATIC_RUNTIME=1 -j "$(nproc)"
+ cp -vr README.* LICENSE tools/ build-release/
cd build-release
rm -f -- *.o
./prpll -h
EOF
- uses: actions/upload-artifact@v7
with:
- name: PRPLL-NTT_linux_x86_opencl
- path: |
- README.*
- LICENSE
- tools/
- build-release/*
+ name: PRPLL-NTT_linux_x64_opencl
+ path: build-release/*
Linux-CUDA:
name: Linux CUDA
@@ -46,13 +49,13 @@ jobs:
matrix:
include:
- cuda: '13.2.1'
- container: 'ubuntu24.04'
+ container: 'rockylinux8'
- cuda: '12.9.2'
- container: 'ubuntu24.04'
+ container: 'rockylinux8'
- cuda: '11.8.0'
- container: 'ubuntu22.04'
- # - cuda: '10.2'
- # container: 'ubuntu18.04'
+ container: 'centos7'
+ - cuda: '10.2'
+ container: 'centos7'
fail-fast: false
steps:
- uses: actions/checkout@v7
@@ -63,26 +66,35 @@ jobs:
run: |
docker run --rm -i -v "$GITHUB_WORKSPACE:/workspace" -w /workspace "nvcr.io/nvidia/cuda:${{ matrix.cuda }}-devel-${{ matrix.container }}" bash -s <<'EOF'
set -e -o pipefail
- apt-get update -y
- apt-get install -y build-essential git
+ if [[ "${{ matrix.container }}" == centos* ]]; then
+ sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
+ # yum update -y
+ yum install -y centos-release-scl epel-release
+ sed -i -e '/^mirrorlist/d;/^# *baseurl=/{s,^# *,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo
+ yum install -y devtoolset-11-gcc-c++ devtoolset-11-libstdc++-static make git
+ source /opt/rh/devtoolset-11/enable
+ else
+ # dnf update -y
+ dnf install -y gcc-toolset-11-gcc-c++ make git
+ source /opt/rh/gcc-toolset-11/enable
+ fi
+
g++ --version
+ ldd --version
- make CUDA=1 ${{ matrix.cuda != '10.2' && 'CUDA_STATIC=1' || '' }} -O -j "$(nproc)"
+ make CUDA=1 STATIC_RUNTIME=1 STATIC_CUDA=${{ matrix.cuda != '10.2' && '1' || '0' }} -j "$(nproc)"
+ cp -vr README.* LICENSE tools/ build-cuda/
cd build-cuda
rm -f -- *.o
if [[ "${{ matrix.cuda }}" == "10.2" ]]; then
- cp /usr/local/cuda/lib64/libnvrtc.so.10.2 /usr/local/cuda/lib64/libnvrtc-builtins.so.10.2 .
+ cp -v /usr/local/cuda/lib64/{libnvrtc.so.10.2,libnvrtc-builtins.so.10.2} .
fi
# ./prpll -h
EOF
- uses: actions/upload-artifact@v7
with:
- name: PRPLL-NTT_linux_x86_cuda_${{ matrix.cuda }}
- path: |
- README.*
- LICENSE
- tools/
- build-cuda/*
+ name: PRPLL-NTT_linux_x64_cuda_${{ matrix.cuda }}
+ path: build-cuda/*
Windows-OpenCL:
name: Windows OpenCL
@@ -104,17 +116,14 @@ jobs:
printf '"%s"\n' "$(basename "$(git describe --tags --long --always)")" > src/version.inc
- name: Script
run: |
- msbuild PRPLL.sln /m /p:Configuration=OpenCL-Release /p:OpenCLRoot=C:\vcpkg\installed\x64-windows
+ msbuild PRPLL.sln /m /p:Configuration=OpenCL-Release /p:StaticRuntime=true /p:OpenCLRoot=C:\vcpkg\installed\x64-windows
+ Copy-Item -Recurse README.*, LICENSE, tools\ build-msvc\OpenCL\Release\
cd build-msvc\OpenCL\Release\
& .\prpll -h
- uses: actions/upload-artifact@v7
with:
- name: PRPLL-NTT_win_x86_opencl
- path: |
- README.*
- LICENSE
- tools/
- build-msvc/OpenCL/Release/*
+ name: PRPLL-NTT_win_x64_opencl
+ path: build-msvc/OpenCL/Release/*
Windows-CUDA:
name: Windows CUDA
@@ -141,17 +150,14 @@ jobs:
printf '"%s"\n' "$(basename "$(git describe --tags --long --always)")" > src/version.inc
- name: Script
run: |
- msbuild PRPLL.sln /m /p:Configuration=CUDA-${{ matrix.cuda != '10.2.89' && 'Release' || 'Release-non-static' }}
- cd build-msvc\CUDA\Release*\
+ msbuild PRPLL.sln /m /p:Configuration=CUDA-Release /p:StaticRuntime=true /p:StaticCUDA=${{ matrix.cuda != '10.2.89' && 'true' || 'false' }}
+ Copy-Item -Recurse README.*, LICENSE, tools\ build-msvc\CUDA\Release\
+ cd build-msvc\CUDA\Release\
if ("${{ matrix.cuda }}" -eq "10.2.89") {
Copy-Item "$env:CUDA_PATH\bin\nvrtc64_102_0.dll", "$env:CUDA_PATH\bin\nvrtc-builtins64_102.dll" .
}
# & .\prpll -h
- uses: actions/upload-artifact@v7
with:
- name: PRPLL-NTT_win_x86_cuda_${{ matrix.cuda }}
- path: |
- README.*
- LICENSE
- tools/
- build-msvc/CUDA/Release*/*
+ name: PRPLL-NTT_win_x64_cuda_${{ matrix.cuda }}
+ path: build-msvc/CUDA/Release/*
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b6f1c7e2..d038df19 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- - cron: '0 0 1 * *'
+ - cron: '0 0 1 * *'
jobs:
Linux-OpenCL:
@@ -48,9 +48,6 @@ jobs:
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-26.04]
cxx: [g++, clang++]
- exclude:
- - os: ubuntu-22.04-arm
- cxx: clang++
fail-fast: false
env:
CXX: ${{ matrix.cxx }}
@@ -133,7 +130,7 @@ jobs:
- name: Install Clang
if: ${{ matrix.cxx == 'clang++' }}
run: |
- pacman -S --noconfirm mingw-w64-x86_64-clang
+ pacman -S --noconfirm "${env:PACKAGE_PREFIX}clang"
& $env:CXX --version
- name: Script
run: |
@@ -204,7 +201,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [macos-15-intel, macos-latest]
+ os: [macos-26-intel, macos-latest]
fail-fast: false
env:
CXX: g++-15
diff --git a/Makefile b/Makefile
index da1dabaf..c41aa5fb 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,11 @@
# On Windows invoke with "make exe" or "make all"
+DEBUG = 0
+CUDA = 0
+STATIC_RUNTIME = 0
+STATIC_CUDA = 0
+
# Uncomment below as desired to set a particular compiler or force a debug build:
# CXX = g++-12
# DEBUG = 1
@@ -12,22 +17,17 @@
HOST_OS = $(shell uname -s)
-ifeq ($(HOST_OS), Darwin)
-# Real GCC (not clang), needed for 128-bit floats and std::filesystem::path
-CXX ?= g++-15
-else
CXX ?= g++
-endif
ifeq ($(CUDA), 1)
BIN=build-cuda
CUDASRCS1 = clwrap_cuda.cpp cudawrap.cpp
CUDAFLAGS = -DCUDA_BACKEND -Isrc/cuda -I/usr/local/cuda/include
CUDAOBJS = $(CUDASRCS1:%.cpp=$(BIN)/%.o)
- ifeq ($(CUDA_STATIC), 1)
- OPENCL_LIBS = -L/usr/local/cuda/lib64 -Wl,--start-group -lnvrtc_static -lnvrtc-builtins_static -lnvptxcompiler_static -Wl,--end-group -lcuda
+ ifeq ($(STATIC_CUDA), 1)
+ OPENCL_LIBS = -L/usr/local/cuda/lib64 -Wl,--start-group -lnvrtc_static -lnvrtc-builtins_static -lnvptxcompiler_static -Wl,--end-group -lcuda -lpthread -ldl
else
- OPENCL_LIBS = -L/usr/local/cuda/lib64 -lnvrtc -lcuda
+ OPENCL_LIBS = -L/usr/local/cuda/lib64 -Wl,-rpath,'$$ORIGIN' -lnvrtc -lcuda -lpthread
endif
else
BIN=build-release
@@ -36,15 +36,24 @@ else
ifeq ($(HOST_OS), Darwin)
OPENCL_LIBS = -framework OpenCL
else
- OPENCL_LIBS = -lOpenCL
+ OPENCL_LIBS = -lOpenCL -lpthread
endif
endif
-ifneq ($(findstring MINGW, $(HOST_OS)), MINGW)
- COMMON_FLAGS = -Wall $(CUDAFLAGS) -std=c++20 -static-libstdc++ -static-libgcc
-else
+COMMON_FLAGS = -Wall -Wextra $(CUDAFLAGS) -std=c++20
+
+ifeq ($(STATIC_RUNTIME),1)
+ LDFLAGS += -static-libstdc++ -static-libgcc
+
+ ifeq ($(findstring MINGW, $(HOST_OS)), MINGW)
# For mingw-64 use this:
- COMMON_FLAGS = -Wall $(CUDAFLAGS) -std=c++20 -static-libstdc++ -static-libgcc -static
+ LDFLAGS += -static
+ endif
+endif
+
+ifeq ($(findstring MINGW, $(HOST_OS)), MINGW)
+ CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
+ LDFLAGS += -Wl,--subsystem,console:6.01
endif
# -fext-numeric-literals
@@ -52,12 +61,10 @@ ifeq ($(DEBUG), 1)
BIN=build-debug
CXXFLAGS = -g -Og $(COMMON_FLAGS)
-STRIP=
else
-CXXFLAGS = -O3 -DNDEBUG $(COMMON_FLAGS)
-STRIP=-s
+CXXFLAGS = -O3 -flto -DNDEBUG $(COMMON_FLAGS)
endif
@@ -81,14 +88,14 @@ prpll: $(BIN)/prpll
amd: $(BIN)/prpll-amd
#$(BIN)/test: $(BIN)/test.o
-# $(CXX) $(CXXFLAGS) -o $@ $< $(LIBPATH) ${STRIP}
+# $(CXX) $(CXXFLAGS) -o $@ $< $(LIBPATH)
$(BIN)/prpll: ${OBJS}
- $(CXX) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) $(OPENCL_LIBS) ${STRIP}
+ $(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) $(OPENCL_LIBS)
# Instead of linking with libOpenCL, link with libamdocl64
$(BIN)/prpll-amd: ${OBJS}
- $(CXX) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) -lamdocl64 -L/opt/rocm/lib ${STRIP}
+ $(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) -lamdocl64 -L/opt/rocm/lib
clean:
rm -rf build-debug build-release build-cuda
diff --git a/PRPLL.sln b/PRPLL.sln
index 25c0cdc3..6eaecdd1 100644
--- a/PRPLL.sln
+++ b/PRPLL.sln
@@ -10,7 +10,6 @@ Global
OpenCL-Release|x64 = OpenCL-Release|x64
CUDA-Debug|x64 = CUDA-Debug|x64
CUDA-Release|x64 = CUDA-Release|x64
- CUDA-Release-non-static|x64 = CUDA-Release-non-static|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.OpenCL-Debug|x64.ActiveCfg = OpenCL-Debug|x64
@@ -21,8 +20,6 @@ Global
{2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.CUDA-Debug|x64.Build.0 = CUDA-Debug|x64
{2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.CUDA-Release|x64.ActiveCfg = CUDA-Release|x64
{2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.CUDA-Release|x64.Build.0 = CUDA-Release|x64
- {2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.CUDA-Release-non-static|x64.ActiveCfg = CUDA-Release-non-static|x64
- {2B3F9C8E-3384-0407-D9E1-D3E86AA8823A}.CUDA-Release-non-static|x64.Build.0 = CUDA-Release-non-static|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PRPLL.vcxproj b/PRPLL.vcxproj
index 49cf61fc..743cb33d 100644
--- a/PRPLL.vcxproj
+++ b/PRPLL.vcxproj
@@ -17,10 +17,6 @@
CUDA-Release
x64
-
- CUDA-Release-non-static
- x64
-
@@ -79,7 +75,7 @@
MultiByte
v143
-
+
Application
false
true
@@ -92,7 +88,10 @@
-
+
+ true
+ false
+
$(ProjectDir)build-msvc\OpenCL\Debug\
$(ProjectDir)build-msvc\obj\OpenCL\Debug\
@@ -115,14 +114,9 @@
$(ProjectDir)build-msvc\obj\CUDA\Release\
prpll
-
- $(ProjectDir)build-msvc\CUDA\Release-non-static\
- $(ProjectDir)build-msvc\obj\CUDA\Release-non-static\
- prpll
-
- Level3
+ Level4
WIN32;WIN64;_CONSOLE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;%(PreprocessorDefinitions)
stdcpp20
Sync
@@ -136,7 +130,8 @@
Disabled
_DEBUG;%(PreprocessorDefinitions)
- MultiThreadedDebugDLL
+ MultiThreadedDebug
+ MultiThreadedDebugDLL
ProgramDatabase
EnableFastChecks
@@ -144,13 +139,14 @@
true
-
+
MaxSpeed
true
true
NDEBUG;%(PreprocessorDefinitions)
- MultiThreaded
+ MultiThreaded
+ MultiThreadedDLL
true
@@ -178,7 +174,7 @@
OpenCL.lib;%(AdditionalDependencies)
-
+
CUDA_BACKEND;%(PreprocessorDefinitions)
$(ProjectDir)\src\cuda;$(CUDA_PATH)\include;%(AdditionalIncludeDirectories)
@@ -187,12 +183,12 @@
$(CUDA_PATH)\lib\x64;%(AdditionalLibraryDirectories)
-
+
cuda.lib;nvrtc.lib;Ws2_32.lib;%(AdditionalDependencies)
-
+
cuda.lib;nvrtc_static.lib;nvrtc-builtins_static.lib;nvptxcompiler_static.lib;User32.lib;Ws2_32.lib;%(AdditionalDependencies)