Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 11 additions & 197 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ jobs:
cd flint-extras
$MAKE tests

- name: "Compile profile"
run: |
cd flint-extras
$MAKE profile

- name: "Check"
run: |
cd flint-extras
Expand Down Expand Up @@ -124,7 +129,7 @@ jobs:
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV

# install FLINT dev version
# install FLINT 3.4.0 version
git clone --depth=1 https://github.com/flintlib/flint.git --branch v3.4.0 --single-branch
cd flint
./bootstrap.sh
Expand Down Expand Up @@ -355,204 +360,13 @@ jobs:
cd flint-extras
$MAKE tests

- name: "Compile profile"
run: |
cd flint-extras
$MAKE profile

- name: "Check"
run: |
cd flint-extras
$MAKE check


#############################################################################
# mingw with gcc
#############################################################################
#mingw64-gcc:
# name: MinGW GCC (x0.5)

# runs-on: windows-latest

# defaults:
# run:
# shell: msys2 {0}

# env:
# CC: "gcc"
# FLINT_TEST_MULTIPLIER: "0.5"

# steps:
# - uses: actions/checkout@v6

# - name: "Setup MinGW"
# uses: msys2/setup-msys2@v2
# with:
# msystem: mingw64
# update: true
# install: bc mingw-w64-x86_64-gcc mingw-w64-x86_64-autotools

# - name: "Rescale multiplier"
# run: |
# FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc)
# echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}"
# echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV

# - name: "Setup"
# run: |
# gcc --version
# make --version
# autoconf --version
# libtool --version
# echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV

# - name: "Configure"
# run: |
# ./bootstrap.sh
# ./configure \
# CC=${CC} \
# --disable-debug

# - name: "Compile library"
# run: |
# ${MAKE}

# - name: "Compile tests"
# run: |
# ${MAKE} tests

# - name: "Check"
# run: |
# ${MAKE} check



##############################################################################
# msvc
##############################################################################
#msvc:
# name: MSVC (x1)

# runs-on: windows-latest
# env:
# FLINT_TEST_MULTIPLIER: 1
# TIMEOUT: 150

# steps:
# - name: "Rescale multiplier (powershell)"
# run: |
# $FLINT_TEST_MULTIPLIER = $env:FLINT_TEST_MULTIPLIER * $env:GLOBAL_MULTIPLIER
# echo "FLINT_TEST_MULTIPLIER=$FLINT_TEST_MULTIPLIER | Out-File -Append -FilePath $env:GITHUB_ENV"
# $TIMEOUT = $env:TIMEOUT * $env:GLOBAL_MULTIPLIER
# echo "TIMEOUT=$TIMEOUT | Out-File -Append -FilePath $env:GITHUB_ENV"
# shell: powershell

# - uses: actions/checkout@v6

# - name: "Setup cache for dependencies"
# uses: actions/github-script@v7
# with:
# script: |
# core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

# - name: "Install dependencies"
# run: |
# vcpkg install gmp mpfr pthreads --binarysource="clear;x-gha,readwrite"

# - name: "Setup MSVC"
# uses: ilammy/msvc-dev-cmd@v1.13.0
# with:
# arch: x86_64

# - name: "Configure"
# run: |
# mkdir build
# cd build
# # For single build, we need atomics
# cmake `
# -G "Ninja" `
# -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
# -DCMAKE_C_FLAGS="/wd4018 /wd4146 /wd4244 /wd4267 /wd4305 /wd4996" `
# -DBUILD_TESTING=ON `
# -DCMAKE_BUILD_TYPE=Release `
# ..

# - name: "Build"
# run: |
# cd build
# # NOTE: Number of threads for Github's CI runners are 4.
# cmake --build . -j5

# - name: "Check"
# run: |
# cd build
# set "FLINT_TEST_MULTIPLIER=$env:FLINT_TEST_MULTIPLIER"
# ctest -j5 --output-on-failure --timeout $env:TIMEOUT
# shell: powershell



##############################################################################
# alpine linux, musl, 32-bit (assert)
##############################################################################
#alpine-32bit:
# name: Alpine Linux, musl, 32-bit (assert, x1.5)

# runs-on: ubuntu-24.04

# env:
# CC: "gcc"
# FLINT_TEST_MULTIPLIER: "1.5"

# steps:
# - name: "Rescale multiplier"
# run: |
# FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc)
# echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}"
# echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV

# - uses: actions/checkout@v6

# - name: "Setup latest Alpine Linux"
# uses: jirutka/setup-alpine@v1
# with:
# arch: x86
# branch: edge
# packages: >
# gmp-dev
# mpfr-dev
# gcc
# musl-dev
# make
# autoconf
# automake
# libtool

# - name: "Setup"
# run: |
# gcc --version
# make --version
# autoconf --version
# libtool --version
# echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
# shell: alpine.sh {0}

# - name: "Configure"
# run: |
# ./bootstrap.sh
# ./configure \
# CC=${CC} \
# --enable-assert \
# --disable-debug
# shell: alpine.sh {0}

# - name: "Compile library"
# run: |
# $MAKE
# shell: alpine.sh {0}

# - name: "Compile tests"
# run: |
# $MAKE tests
# shell: alpine.sh {0}

# - name: "Check"
# run: |
# $MAKE check
# shell: alpine.sh {0}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ matrices, structured matrices, and their applications.
Version 0.5

Warning: the FLINT-based part of PML (flint-extras folder) is work in progress.
Currently, it requires FLINT version 3.4.0 (November 2025) or later.
Currently, it requires FLINT version 3.4.0 (November 2025) or later. Compiling
benchmark files with `make profile` might further require the current
development version of FLINT.

## Authors

Expand Down
75 changes: 72 additions & 3 deletions flint-extras/src/nmod32_vec/profile/p-dot_mdot.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ void sample_dot_msolve_avx2(void * arg, ulong count)
FLINT_TEST_CLEAR(state);
}
#else /* PML_HAVE_AVX2 */
TIME_VOID_DOT(dot_msolve_avx2, pow2_precomp);
SAMPLE_VOID_DOT(dot_msolve_avx2, pow2_precomp);
TIME_VOID_DOT(dot_msolve_avx2, pow2_precomp)
SAMPLE_VOID_DOT(dot_msolve_avx2, pow2_precomp)
#endif /* PML_HAVE_AVX2 */

/*-----------------------*/
Expand Down Expand Up @@ -360,6 +360,7 @@ int main(int argc, char ** argv)
const slong nlens = 10;
const ulong lens[] = {50, 100, 250, 500, 1000, 2500, 5000, 10000, 100000, 1000000};

#if PML_HAVE_AVX512
// bench functions
const slong nfuns = 16;
typedef void (*timefun) (time_args, flint_rand_t);
Expand Down Expand Up @@ -421,6 +422,74 @@ int main(int argc, char ** argv)
"#15 --> mdot3_split_avx512 ",
};

#elif PML_HAVE_AVX2
// bench functions
const slong nfuns = 11;
typedef void (*timefun) (time_args, flint_rand_t);
const timefun funs[] = {
time_dot_split, // 0
time_dot_split_avx2, // 1
time_dot_msolve_avx2, // 2
time_mdot_split, // 3
time_mdot_split_avx2, // 4
time_mdot_msolve_via_dot_avx2, // 5
time_mdot_msolve_native_avx2, // 6
time_mdot2_split, // 7
time_mdot2_split_avx2, // 8
time_mdot3_split_avx2, // 9
};

typedef void (*samplefun) (void*, ulong);
const samplefun sfuns[] = {
sample_dot_split, // 0
sample_dot_split_avx2, // 1
sample_dot_msolve_avx2, // 2
sample_mdot_split, // 3
sample_mdot_split_avx2, // 4
sample_mdot_msolve_via_dot_avx2, // 5
sample_mdot_msolve_native_avx2, // 6
sample_mdot2_split, // 7
sample_mdot2_split_avx2, // 8
sample_mdot3_split_avx2, // 9
};

const char * description[] = {
"#0 --> dot_split ",
"#1 --> dot_split_avx2 ",
"#2 --> dot_msolve_avx2 ",
"#3 --> mdot_split ",
"#4 --> mdot_split_avx2 ",
"#5 --> mdot_msolve_via_dot_avx2 ",
"#6 --> mdot_msolve_native_avx2 ",
"#7 --> mdot2_split ",
"#8 --> mdot2_split_avx2 ",
"#9 --> mdot3_split_avx2 ",
};

#else /* i.e. neither PML_HAVE_AVX512 nor PML_HAVE_AVX2 */
// bench functions
const slong nfuns = 3;
typedef void (*timefun) (time_args, flint_rand_t);
const timefun funs[] = {
time_dot_split, // 0
time_mdot_split, // 1
time_mdot2_split, // 2
};

typedef void (*samplefun) (void*, ulong);
const samplefun sfuns[] = {
sample_dot_split, // 0
sample_mdot_split, // 1
sample_mdot2_split, // 2
};

const char * description[] = {
"#0 --> dot_split ",
"#1 --> mdot_split ",
"#2 --> mdot2_split ",
};
#endif

if (argc == 1) // show usage
{
printf("Usage: `%s [nbits] [len] [fun]`\n", argv[0]);
Expand Down Expand Up @@ -453,7 +522,7 @@ int main(int argc, char ** argv)
for (slong i = 0; i < 3; i++)
{
time_args targs = {1, 10000, UWORD(1) << 20};
time_dot_split_avx2(targs, state);
time_dot_split(targs, state);
printf(" ");
}
printf("\n\n");
Expand Down
2 changes: 1 addition & 1 deletion flint-extras/src/nmod_mat_extra/profile/p-mul_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void time_nmod_mat_mul(ulong len, ulong nbits, ulong n, flint_rand_t state)
/*--------------------------------------------------------------*/
/* main calls time */
/*--------------------------------------------------------------*/
int main()
int main(int FLINT_UNUSED(argc), char ** FLINT_UNUSED(argv))
{
flint_rand_t state;
flint_rand_init(state);
Expand Down
Loading