From f168b885db26c1121486c5f4d219968f4474e0c1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 1 May 2022 14:32:30 +0200 Subject: [PATCH] Removed IPP dependency with intel using C quicksort --- config/ifort_2019_avx.cfg | 2 +- config/ifort_2019_avx_mpi.cfg | 2 +- config/ifort_2019_mpi_rome.cfg | 2 +- config/ifort_2019_rome.cfg | 2 +- config/ifort_2019_sse4.cfg | 2 +- config/ifort_2019_sse4_mpi.cfg | 2 +- config/ifort_2019_xHost.cfg | 2 +- config/ifort_2021_avx.cfg | 2 +- config/ifort_2021_avx_mpi.cfg | 2 +- config/ifort_2021_mpi_rome.cfg | 2 +- config/ifort_2021_rome.cfg | 2 +- config/ifort_2021_sse4.cfg | 2 +- config/ifort_2021_sse4_mpi.cfg | 2 +- config/ifort_2021_xHost.cfg | 2 +- src/fci/40.fci.bats | 2 +- src/utils/qsort.c | 100 ++++++++++++++++----------------- src/utils/qsort.org | 10 ++-- 17 files changed, 70 insertions(+), 70 deletions(-) diff --git a/config/ifort_2019_avx.cfg b/config/ifort_2019_avx.cfg index 661a0e8f..c5bed0d8 100644 --- a/config/ifort_2019_avx.cfg +++ b/config/ifort_2019_avx.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_avx_mpi.cfg b/config/ifort_2019_avx_mpi.cfg index 2d212db5..5b4d2922 100644 --- a/config/ifort_2019_avx_mpi.cfg +++ b/config/ifort_2019_avx_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_mpi_rome.cfg b/config/ifort_2019_mpi_rome.cfg index 171219e6..054d4d7d 100644 --- a/config/ifort_2019_mpi_rome.cfg +++ b/config/ifort_2019_mpi_rome.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_rome.cfg b/config/ifort_2019_rome.cfg index e923a1dd..a18a0acb 100644 --- a/config/ifort_2019_rome.cfg +++ b/config/ifort_2019_rome.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_sse4.cfg b/config/ifort_2019_sse4.cfg index a3aa7cbd..2cdbc2c5 100644 --- a/config/ifort_2019_sse4.cfg +++ b/config/ifort_2019_sse4.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_sse4_mpi.cfg b/config/ifort_2019_sse4_mpi.cfg index 6959d176..d20cd2a2 100644 --- a/config/ifort_2019_sse4_mpi.cfg +++ b/config/ifort_2019_sse4_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_xHost.cfg b/config/ifort_2019_xHost.cfg index 22d28803..59c6146b 100644 --- a/config/ifort_2019_xHost.cfg +++ b/config/ifort_2019_xHost.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=64 -DINTEL -DSET_NESTED diff --git a/config/ifort_2021_avx.cfg b/config/ifort_2021_avx.cfg index 6f657052..6c34cf47 100644 --- a/config/ifort_2021_avx.cfg +++ b/config/ifort_2021_avx.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_avx_mpi.cfg b/config/ifort_2021_avx_mpi.cfg index c991a4a9..4c893c73 100644 --- a/config/ifort_2021_avx_mpi.cfg +++ b/config/ifort_2021_avx_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_mpi_rome.cfg b/config/ifort_2021_mpi_rome.cfg index 8413d23d..e47a466e 100644 --- a/config/ifort_2021_mpi_rome.cfg +++ b/config/ifort_2021_mpi_rome.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_rome.cfg b/config/ifort_2021_rome.cfg index b3023186..504438c9 100644 --- a/config/ifort_2021_rome.cfg +++ b/config/ifort_2021_rome.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_sse4.cfg b/config/ifort_2021_sse4.cfg index a6299665..07c3ebb8 100644 --- a/config/ifort_2021_sse4.cfg +++ b/config/ifort_2021_sse4.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_sse4_mpi.cfg b/config/ifort_2021_sse4_mpi.cfg index 6ae56d2a..f3fa0eaa 100644 --- a/config/ifort_2021_sse4_mpi.cfg +++ b/config/ifort_2021_sse4_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_xHost.cfg b/config/ifort_2021_xHost.cfg index 1e76a69d..1161833b 100644 --- a/config/ifort_2021_xHost.cfg +++ b/config/ifort_2021_xHost.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=64 -DINTEL diff --git a/src/fci/40.fci.bats b/src/fci/40.fci.bats index 1a0c5507..23818f44 100644 --- a/src/fci/40.fci.bats +++ b/src/fci/40.fci.bats @@ -65,7 +65,7 @@ function run_stoch() { @test "H2O2" { # 12.9214s qp set_file h2o2.ezfio qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-38]" - run -151.005848404095 1.e-3 100000 + run -151.005848404095 2.e-3 100000 } @test "HBO" { # 13.3144s diff --git a/src/utils/qsort.c b/src/utils/qsort.c index 5d685741..c011b35a 100644 --- a/src/utils/qsort.c +++ b/src/utils/qsort.c @@ -9,14 +9,14 @@ struct int16_t_comp { int compare_int16_t( const void * l, const void * r ) { - const struct int16_t_comp * restrict _l= l; - const struct int16_t_comp * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int16_t * restrict _l= l; + const int16_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int16_t(int16_t* A_in, int32_t* iorder, int32_t isize) { +void qsort_int16_t(int16_t* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct int16_t_comp* A = malloc(isize * sizeof(struct int16_t_comp)); if (A == NULL) return; @@ -46,14 +46,14 @@ struct int16_t_comp_big { int compare_int16_t_big( const void * l, const void * r ) { - const struct int16_t_comp_big * restrict _l= l; - const struct int16_t_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int16_t * restrict _l= l; + const int16_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int16_t_big(int16_t* A_in, int64_t* iorder, int64_t isize) { +void qsort_int16_t_big(int16_t* restrict A_in, int64_t* restrict iorder, int64_t isize) { struct int16_t_comp_big* A = malloc(isize * sizeof(struct int16_t_comp_big)); if (A == NULL) return; @@ -83,14 +83,14 @@ struct int32_t_comp { int compare_int32_t( const void * l, const void * r ) { - const struct int32_t_comp * restrict _l= l; - const struct int32_t_comp * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int32_t * restrict _l= l; + const int32_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int32_t(int32_t* A_in, int32_t* iorder, int32_t isize) { +void qsort_int32_t(int32_t* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct int32_t_comp* A = malloc(isize * sizeof(struct int32_t_comp)); if (A == NULL) return; @@ -120,14 +120,14 @@ struct int32_t_comp_big { int compare_int32_t_big( const void * l, const void * r ) { - const struct int32_t_comp_big * restrict _l= l; - const struct int32_t_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int32_t * restrict _l= l; + const int32_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int32_t_big(int32_t* A_in, int64_t* iorder, int64_t isize) { +void qsort_int32_t_big(int32_t* restrict A_in, int64_t* restrict iorder, int64_t isize) { struct int32_t_comp_big* A = malloc(isize * sizeof(struct int32_t_comp_big)); if (A == NULL) return; @@ -157,14 +157,14 @@ struct int64_t_comp { int compare_int64_t( const void * l, const void * r ) { - const struct int64_t_comp * restrict _l= l; - const struct int64_t_comp * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int64_t * restrict _l= l; + const int64_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int64_t(int64_t* A_in, int32_t* iorder, int32_t isize) { +void qsort_int64_t(int64_t* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct int64_t_comp* A = malloc(isize * sizeof(struct int64_t_comp)); if (A == NULL) return; @@ -194,14 +194,14 @@ struct int64_t_comp_big { int compare_int64_t_big( const void * l, const void * r ) { - const struct int64_t_comp_big * restrict _l= l; - const struct int64_t_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const int64_t * restrict _l= l; + const int64_t * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_int64_t_big(int64_t* A_in, int64_t* iorder, int64_t isize) { +void qsort_int64_t_big(int64_t* restrict A_in, int64_t* restrict iorder, int64_t isize) { struct int64_t_comp_big* A = malloc(isize * sizeof(struct int64_t_comp_big)); if (A == NULL) return; @@ -231,14 +231,14 @@ struct double_comp { int compare_double( const void * l, const void * r ) { - const struct double_comp * restrict _l= l; - const struct double_comp * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const double * restrict _l= l; + const double * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_double(double* A_in, int32_t* iorder, int32_t isize) { +void qsort_double(double* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct double_comp* A = malloc(isize * sizeof(struct double_comp)); if (A == NULL) return; @@ -268,14 +268,14 @@ struct double_comp_big { int compare_double_big( const void * l, const void * r ) { - const struct double_comp_big * restrict _l= l; - const struct double_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const double * restrict _l= l; + const double * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_double_big(double* A_in, int64_t* iorder, int64_t isize) { +void qsort_double_big(double* restrict A_in, int64_t* restrict iorder, int64_t isize) { struct double_comp_big* A = malloc(isize * sizeof(struct double_comp_big)); if (A == NULL) return; @@ -305,14 +305,14 @@ struct float_comp { int compare_float( const void * l, const void * r ) { - const struct float_comp * restrict _l= l; - const struct float_comp * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const float * restrict _l= l; + const float * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_float(float* A_in, int32_t* iorder, int32_t isize) { +void qsort_float(float* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct float_comp* A = malloc(isize * sizeof(struct float_comp)); if (A == NULL) return; @@ -342,14 +342,14 @@ struct float_comp_big { int compare_float_big( const void * l, const void * r ) { - const struct float_comp_big * restrict _l= l; - const struct float_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const float * restrict _l= l; + const float * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_float_big(float* A_in, int64_t* iorder, int64_t isize) { +void qsort_float_big(float* restrict A_in, int64_t* restrict iorder, int64_t isize) { struct float_comp_big* A = malloc(isize * sizeof(struct float_comp_big)); if (A == NULL) return; diff --git a/src/utils/qsort.org b/src/utils/qsort.org index 0c344207..abf0d54a 100644 --- a/src/utils/qsort.org +++ b/src/utils/qsort.org @@ -11,14 +11,14 @@ struct TYPE_comp_big { int compare_TYPE_big( const void * l, const void * r ) { - const struct TYPE_comp_big * restrict _l= l; - const struct TYPE_comp_big * restrict _r= r; - if( _l->x > _r->x ) return 1; - if( _l->x < _r->x ) return -1; + const TYPE * restrict _l= l; + const TYPE * restrict _r= r; + if( *_l > *_r ) return 1; + if( *_l < *_r ) return -1; return 0; } -void qsort_TYPE_big(TYPE* A_in, int32_t* iorder, int32_t isize) { +void qsort_TYPE_big(TYPE* restrict A_in, int32_t* restrict iorder, int32_t isize) { struct TYPE_comp_big* A = malloc(isize * sizeof(struct TYPE_comp_big)); if (A == NULL) return;