diff --git a/.github/workflows/ci_modular.yml b/.github/workflows/ci_modular.yml new file mode 100644 index 000000000..329db5b1f --- /dev/null +++ b/.github/workflows/ci_modular.yml @@ -0,0 +1,80 @@ +name: CI + +on: [push, pull_request] + +env: + CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds + CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest + CTEST_PARALLEL_LEVEL: "2" + CTEST_TIME_TIMEOUT: "5" # some failures hang forever + HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker + HOMEBREW_NO_AUTO_UPDATE: "ON" + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" + HOMEBREW_NO_GITHUB_API: "ON" + HOMEBREW_NO_INSTALL_CLEANUP: "ON" + +jobs: + Build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + toolchain: + - {compiler: gcc, version: 14} + build: [cmake] + with_bitsets: [On, Off] + env: + BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.x + uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc. + with: + python-version: 3.x + + - name: Install fypp + run: pip install --upgrade fypp ninja + + - name: Setup Fortran compiler + uses: fortran-lang/setup-fortran@v1.6.2 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + + # Build and test with built-in BLAS and LAPACK + - name: Configure with CMake + if: ${{ contains(matrix.build, 'cmake') }} + run: >- + cmake -Wdev -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_MAXIMUM_RANK:String=4 + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + -DFIND_BLAS:STRING=FALSE + -DWITH_BITSETS:STRING=${{ matrix.with_bitsets }} + -S . -B ${{ env.BUILD_DIR }} + + - name: Build and compile + if: ${{ contains(matrix.build, 'cmake') }} + run: cmake --build ${{ env.BUILD_DIR }} --parallel + + - name: catch build fail + if: ${{ failure() && contains(matrix.build, 'cmake') }} + run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1 + + - name: test + if: ${{ contains(matrix.build, 'cmake') }} + run: >- + ctest + --test-dir ${{ env.BUILD_DIR }} + --parallel + --output-on-failure + --no-tests=error + + - name: Install project + if: ${{ contains(matrix.build, 'cmake') }} + run: cmake --install ${{ env.BUILD_DIR }} diff --git a/CMakeLists.txt b/CMakeLists.txt index a0039d0b5..cd60bb3a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,8 @@ if(NOT DEFINED CMAKE_MAXIMUM_RANK) set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures") endif() +option(WITH_BITSETS "Compile STDLIB BITSETS" ON) + option(FIND_BLAS "Find external BLAS and LAPACK" ON) # --- find external BLAS and LAPACK @@ -118,6 +120,7 @@ endif() list( APPEND fyppFlags + "-DWITH_BITSETS=$" "-DWITH_CBOOL=$" "-DWITH_QP=$" "-DWITH_XDP=$" diff --git a/config/fypp_deployment.py b/config/fypp_deployment.py index aa44b1df0..dbd621a28 100644 --- a/config/fypp_deployment.py +++ b/config/fypp_deployment.py @@ -25,6 +25,8 @@ def pre_process_fypp(args): kwd.append("-DPROJECT_VERSION_MAJOR="+str(args.vmajor)) kwd.append("-DPROJECT_VERSION_MINOR="+str(args.vminor)) kwd.append("-DPROJECT_VERSION_PATCH="+str(args.vpatch)) + if args.no_bitsets: + kwd.append("-DWITH_BITSETS=False") if args.with_qp: kwd.append("-DWITH_QP=True") if args.with_xdp: @@ -133,6 +135,7 @@ def fpm_build(args,unknown): parser.add_argument("--njob", type=int, default=4, help="Number of parallel jobs for preprocessing") parser.add_argument("--maxrank",type=int, default=4, help="Set the maximum allowed rank for arrays") + parser.add_argument("--no_bitsets",action='store_true', help="Include WITH_BITSETS=False in the command") parser.add_argument("--with_qp",action='store_true', help="Include WITH_QP in the command") parser.add_argument("--with_xdp",action='store_true', help="Include WITH_XDP in the command") parser.add_argument("--with_ilp64",action='store_true', help="Include WITH_ILP64 to build 64-bit integer BLAS/LAPACK") diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 16c83e332..0acf893ff 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -9,7 +9,9 @@ endmacro(ADD_EXAMPLE) add_subdirectory(ansi) add_subdirectory(array) add_subdirectory(ascii) -add_subdirectory(bitsets) +if (WITH_BITSETS) + add_subdirectory(bitsets) +endif() add_subdirectory(constants) add_subdirectory(error) add_subdirectory(hashmaps) diff --git a/example/math/example_math_swap.f90 b/example/math/example_math_swap.f90 index 7c2388b05..4ee5969cb 100644 --- a/example/math/example_math_swap.f90 +++ b/example/math/example_math_swap.f90 @@ -43,12 +43,4 @@ program example_math_swap call swap(x,y) end block - block - use stdlib_bitsets - type(bitset_64) :: x, y - call x%from_string('0000') - call y%from_string('1111') - call swap(x,y) - end block - -end program example_math_swap \ No newline at end of file +end program example_math_swap diff --git a/example/sorting/CMakeLists.txt b/example/sorting/CMakeLists.txt index 6d64ea2f1..827342a95 100644 --- a/example/sorting/CMakeLists.txt +++ b/example/sorting/CMakeLists.txt @@ -3,4 +3,6 @@ ADD_EXAMPLE(sort) ADD_EXAMPLE(sort_adjoint) ADD_EXAMPLE(sort_index) ADD_EXAMPLE(radix_sort) +if (WITH_BITSETS) ADD_EXAMPLE(sort_bitset) +endif() diff --git a/include/common.fypp b/include/common.fypp index de0a7b911..787c69520 100644 --- a/include/common.fypp +++ b/include/common.fypp @@ -18,6 +18,11 @@ #:set WITH_XDP = False #:endif +#! Support for bitsets +#:if not defined("WITH_BITSETS") +#:set WITH_BITSETS = True +#:endif + #! Support for linear algebra with 64-bit integer sizes #:if not defined("WITH_ILP64") #:set WITH_ILP64 = False diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 826dc1eda..bce5baac7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,12 @@ +if (WITH_BITSETS) + add_subdirectory(bitsets) +endif() + add_subdirectory(blas) add_subdirectory(lapack) set(fppFiles stdlib_ascii.fypp - stdlib_bitsets.fypp - stdlib_bitsets_64.fypp - stdlib_bitsets_large.fypp stdlib_codata_type.fypp stdlib_constants.fypp stdlib_error.fypp @@ -121,4 +122,7 @@ set(f90Files configure_stdlib_target(${PROJECT_NAME} f90Files fppFiles cppFiles) -target_link_libraries(${PROJECT_NAME} PUBLIC blas lapack) +target_link_libraries(${PROJECT_NAME} PUBLIC + $<$:bitsets> + blas lapack) + diff --git a/src/bitsets/CMakeLists.txt b/src/bitsets/CMakeLists.txt new file mode 100644 index 000000000..4f30729ff --- /dev/null +++ b/src/bitsets/CMakeLists.txt @@ -0,0 +1,9 @@ +set(bitsets_fppFiles + ../stdlib_kinds.fypp + ../stdlib_optval.fypp + stdlib_bitsets.fypp + stdlib_bitsets_64.fypp + stdlib_bitsets_large.fypp +) + +configure_stdlib_target(bitsets "" bitsets_fppFiles "") diff --git a/src/stdlib_bitsets.fypp b/src/bitsets/stdlib_bitsets.fypp similarity index 100% rename from src/stdlib_bitsets.fypp rename to src/bitsets/stdlib_bitsets.fypp diff --git a/src/stdlib_bitsets_64.fypp b/src/bitsets/stdlib_bitsets_64.fypp similarity index 100% rename from src/stdlib_bitsets_64.fypp rename to src/bitsets/stdlib_bitsets_64.fypp diff --git a/src/stdlib_bitsets_large.fypp b/src/bitsets/stdlib_bitsets_large.fypp similarity index 100% rename from src/stdlib_bitsets_large.fypp rename to src/bitsets/stdlib_bitsets_large.fypp diff --git a/src/stdlib_math.fypp b/src/stdlib_math.fypp index 1b1abb363..06dd573d0 100644 --- a/src/stdlib_math.fypp +++ b/src/stdlib_math.fypp @@ -1,11 +1,20 @@ #:include "common.fypp" #:set IR_KINDS_TYPES = INT_KINDS_TYPES + REAL_KINDS_TYPES #:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES + +#:set IRB_KIND_TYPES = INT_KINDS_TYPES + REAL_KINDS_TYPES + +#:if WITH_BITSETS #:set BITSET_KINDS_TYPES = list(zip(BITSET_KINDS, BITSET_TYPES)) +#:set IRB_KIND_TYPES = IRB_KIND_TYPES + BITSET_KINDS_TYPES +#:endif + module stdlib_math use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, xdp, qp use stdlib_optval, only: optval +#:if WITH_BITSETS use stdlib_bitsets, only: bitset_64, bitset_large +#:endif implicit none private @@ -48,7 +57,7 @@ module stdlib_math !> !> Version: experimental interface swap - #:for k1, t1 in INT_KINDS_TYPES + REAL_KINDS_TYPES + BITSET_KINDS_TYPES + #:for k1, t1 in IRB_KIND_TYPES module procedure :: swap_${k1}$ #:endfor #:for k1, t1 in CMPLX_KINDS_TYPES @@ -527,7 +536,7 @@ contains #:endfor - #:for k1, t1 in INT_KINDS_TYPES + REAL_KINDS_TYPES + BITSET_KINDS_TYPES + #:for k1, t1 in IRB_KIND_TYPES elemental subroutine swap_${k1}$(lhs, rhs) ${t1}$, intent(inout) :: lhs, rhs ${t1}$ :: temp diff --git a/src/stdlib_sorting.fypp b/src/stdlib_sorting.fypp index c675e5f3f..350ee4d2a 100644 --- a/src/stdlib_sorting.fypp +++ b/src/stdlib_sorting.fypp @@ -4,17 +4,20 @@ #:set REAL_TYPES_ALT_NAME = list(zip(REAL_TYPES, REAL_TYPES, REAL_KINDS)) #:set STRING_TYPES_ALT_NAME = list(zip(STRING_TYPES, STRING_TYPES, STRING_KINDS)) #:set CHAR_TYPES_ALT_NAME = list(zip(["character(len=*)"], ["character(len=len(array))"], ["char"])) -#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) #:set INT_INDEX_TYPES_ALT_NAME = list(zip(["int_index", "int_index_low"], ["integer(int_index)", "integer(int_index_low)"], ["default", "low"])) #! For better code reuse in fypp, make lists that contain the input types, #! with each having output types and a separate name prefix for subroutines #! This approach allows us to have the same code for all input types. -#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME & - & + BITSET_TYPES_ALT_NAME +#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME #:set IR_INDEX_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME +#:if WITH_BITSETS +#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) +#:set IRSCB_TYPES_ALT_NAME = IRSCB_TYPES_ALT_NAME + BITSET_TYPES_ALT_NAME +#:endif + !! Licensing: !! !! This file is subject both to the Fortran Standard Library license, and @@ -134,8 +137,10 @@ module stdlib_sorting use stdlib_string_type, only: string_type, assignment(=), operator(>), & operator(>=), operator(<), operator(<=) +#:if WITH_BITSETS use stdlib_bitsets, only: bitset_64, bitset_large, & assignment(=), operator(>), operator(>=), operator(<), operator(<=) +#:endif implicit none private diff --git a/src/stdlib_sorting_ord_sort.fypp b/src/stdlib_sorting_ord_sort.fypp index c77e1c797..c17187474 100644 --- a/src/stdlib_sorting_ord_sort.fypp +++ b/src/stdlib_sorting_ord_sort.fypp @@ -3,13 +3,16 @@ #:set REAL_TYPES_ALT_NAME = list(zip(REAL_TYPES, REAL_TYPES, REAL_TYPES, REAL_KINDS)) #:set STRING_TYPES_ALT_NAME = list(zip(STRING_TYPES, STRING_TYPES, STRING_TYPES, STRING_KINDS)) #:set CHAR_TYPES_ALT_NAME = list(zip(["character(len=*)"], ["character(len=:)"], ["character(len=len(array))"], ["char"])) -#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) #! For better code reuse in fypp, make lists that contain the input types, #! with each having output types and a separate name prefix for subroutines #! This approach allows us to have the same code for all input types. -#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME & - & + BITSET_TYPES_ALT_NAME +#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME + +#:if WITH_BITSETS +#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) +#:set IRSCB_TYPES_ALT_NAME = IRSCB_TYPES_ALT_NAME + BITSET_TYPES_ALT_NAME +#:endif #:set SIGN_NAME = ["increase", "decrease"] #:set SIGN_TYPE = [">", "<"] diff --git a/src/stdlib_sorting_sort.fypp b/src/stdlib_sorting_sort.fypp index dcca28a0d..d005f0a2b 100644 --- a/src/stdlib_sorting_sort.fypp +++ b/src/stdlib_sorting_sort.fypp @@ -3,13 +3,16 @@ #:set REAL_TYPES_ALT_NAME = list(zip(REAL_TYPES, REAL_TYPES, REAL_KINDS)) #:set STRING_TYPES_ALT_NAME = list(zip(STRING_TYPES, STRING_TYPES, STRING_KINDS)) #:set CHAR_TYPES_ALT_NAME = list(zip(["character(len=*)"], ["character(len=len(array))"], ["char"])) -#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) #! For better code reuse in fypp, make lists that contain the input types, #! with each having output types and a separate name prefix for subroutines #! This approach allows us to have the same code for all input types. -#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME & - & + BITSET_TYPES_ALT_NAME +#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME + +#:if WITH_BITSETS +#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) +#:set IRSCB_TYPES_ALT_NAME = IRSCB_TYPES_ALT_NAME + BITSET_TYPES_ALT_NAME +#:endif #:set SIGN_NAME = ["increase", "decrease"] #:set SIGN_TYPE = [">", "<"] diff --git a/src/stdlib_sorting_sort_adjoint.fypp b/src/stdlib_sorting_sort_adjoint.fypp index a8b99b034..6b8a9f7c1 100644 --- a/src/stdlib_sorting_sort_adjoint.fypp +++ b/src/stdlib_sorting_sort_adjoint.fypp @@ -3,15 +3,18 @@ #:set REAL_TYPES_ALT_NAME = list(zip(REAL_TYPES, REAL_TYPES, REAL_TYPES, REAL_KINDS)) #:set STRING_TYPES_ALT_NAME = list(zip(STRING_TYPES, STRING_TYPES, STRING_TYPES, STRING_KINDS)) #:set CHAR_TYPES_ALT_NAME = list(zip(["character(len=*)"], ["character(len=:)"], ["character(len=len(array))"], ["char"])) -#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) #! For better code reuse in fypp, make lists that contain the input types, #! with each having output types and a separate name prefix for subroutines #! This approach allows us to have the same code for all input types. -#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME & - & + BITSET_TYPES_ALT_NAME +#:set IRSCB_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME #:set IR_INDEX_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME +#:if WITH_BITSETS +#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_TYPES, BITSET_KINDS)) +#:set IRSCB_TYPES_ALT_NAME = IRSCB_TYPES_ALT_NAME + BITSET_TYPES_ALT_NAME +#:endif + !! Licensing: !! !! This file is subjec† both to the Fortran Standard Library license, and diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 92e06c987..276c12cad 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,7 +29,9 @@ endmacro(ADDTESTPP) add_subdirectory(array) add_subdirectory(ascii) -add_subdirectory(bitsets) +if (WITH_BITSETS) + add_subdirectory(bitsets) +endif() add_subdirectory(constants) add_subdirectory(hash_functions) add_subdirectory(hash_functions_perf) diff --git a/test/math/test_stdlib_math.fypp b/test/math/test_stdlib_math.fypp index 1365756b9..c49173d6b 100644 --- a/test/math/test_stdlib_math.fypp +++ b/test/math/test_stdlib_math.fypp @@ -370,6 +370,7 @@ contains if (allocated(error)) return end subroutine test_swap_stt + #:if WITH_BITSETS subroutine test_swap_bitset_64(error) use stdlib_bitsets type(error_type), allocatable, intent(out) :: error @@ -415,6 +416,7 @@ contains call check(error, x == v ) if (allocated(error)) return end subroutine test_swap_bitset_large + #:endif #:for k1 in CMPLX_KINDS subroutine test_arg_${k1}$(error) diff --git a/test/sorting/test_sorting.fypp b/test/sorting/test_sorting.fypp index 025440147..a39434fe5 100644 --- a/test/sorting/test_sorting.fypp +++ b/test/sorting/test_sorting.fypp @@ -11,8 +11,10 @@ module test_sorting use stdlib_sorting, only: sort, sort_index, sort_adjoint, ord_sort, radix_sort, int_index, int_index_low use stdlib_string_type, only: string_type, assignment(=), operator(>), & operator(<), write(formatted) +#:if WITH_BITSETS use stdlib_bitsets, only: bitset_64, bitset_large, & assignment(=), operator(>), operator(<) +#:endif use testdrive, only: new_unittest, unittest_type, error_type, check implicit none @@ -45,6 +47,7 @@ module test_sorting string_decrease(0:string_size-1), & string_increase(0:string_size-1), & string_rand(0:string_size-1) +#:if WITH_BITSETS type(bitset_large) :: & bitsetl_decrease(0:bitset_size-1), & bitsetl_increase(0:bitset_size-1), & @@ -53,20 +56,25 @@ module test_sorting bitset64_decrease(0:bitset_size-1), & bitset64_increase(0:bitset_size-1), & bitset64_rand(0:bitset_size-1) +#:endif integer(int32) :: dummy(0:test_size-1) real(sp) :: real_dummy(0:test_size-1) character(len=4) :: char_dummy(0:char_size-1) type(string_type) :: string_dummy(0:string_size-1) +#:if WITH_BITSETS type(bitset_large) :: bitsetl_dummy(0:bitset_size-1) type(bitset_64) :: bitset64_dummy(0:bitset_size-1) +#:endif integer(int_index) :: index_default(0:max(test_size, char_size, string_size)-1) integer(int_index_low) :: index_low(0:max(test_size, char_size, string_size)-1) integer(int32) :: work(0:test_size/2-1) character(len=4) :: char_work(0:char_size/2-1) type(string_type) :: string_work(0:string_size/2-1) +#:if WITH_BITSETS type(bitset_large) :: bitsetl_work(0:bitset_size/2-1) type(bitset_64) :: bitset64_work(0:bitset_size/2-1) +#:endif integer(int_index) :: iwork_default(0:max(test_size, char_size, & string_size)/2-1) integer(int_index_low) :: iwork_low(0:max(test_size, char_size, & @@ -77,8 +85,10 @@ module test_sorting integer :: lun character(len=4) :: char_temp type(string_type) :: string_temp +#:if WITH_BITSETS type(bitset_large) :: bitsetl_temp type(bitset_64) :: bitset64_temp +#:endif logical :: ltest, ldummy character(32) :: bin32 character(64) :: bin64 @@ -93,28 +103,36 @@ contains testsuite = [ & new_unittest('char_ord_sorts', test_char_ord_sorts), & new_unittest('string_ord_sorts', test_string_ord_sorts), & +#:if WITH_BITSETS new_unittest('bitset_large_ord_sorts', test_bitsetl_ord_sorts), & new_unittest('bitset_64_ord_sorts', test_bitset64_ord_sorts), & +#:endif new_unittest('int_radix_sorts', test_int_radix_sorts), & new_unittest('real_radix_sorts', test_real_radix_sorts), & new_unittest('int_sorts', test_int_sorts), & new_unittest('char_sorts', test_char_sorts), & new_unittest('string_sorts', test_string_sorts), & +#:if WITH_BITSETS new_unittest('bitset_large_sorts', test_bitsetl_sorts), & new_unittest('bitset_64_sorts', test_bitset64_sorts), & +#:endif #:for ki, ti, namei in INT_INDEX_TYPES_ALT_NAME new_unittest('int_sort_indexes_${namei}$', test_int_sort_indexes_${namei}$), & new_unittest('char_sort_indexes_${namei}$', test_char_sort_indexes_${namei}$), & new_unittest('string_sort_indexes_${namei}$', test_string_sort_indexes_${namei}$), & + #:if WITH_BITSETS new_unittest('bitset_large_sort_indexes_${namei}$', test_bitsetl_sort_indexes_${namei}$), & new_unittest('bitset_64_sort_indexes_${namei}$', test_bitset64_sort_indexes_${namei}$), & + #:endif #:endfor #:for ki, ti, namei in INT_TYPES_ALT_NAME new_unittest('int_sort_adjointes_${namei}$', test_int_sort_adjointes_${namei}$), & new_unittest('char_sort_adjointes_${namei}$', test_char_sort_adjointes_${namei}$), & new_unittest('string_sort_adjointes_${namei}$', test_string_sort_adjointes_${namei}$), & + #:if WITH_BITSETS new_unittest('bitset_large_sort_adjointes_${namei}$', test_bitsetl_sort_adjointes_${namei}$), & new_unittest('bitset_64_sort_adjointes_${namei}$', test_bitset64_sort_adjointes_${namei}$), & + #:endif #:endfor #:for ki, ti, namei in REAL_TYPES_ALT_NAME new_unittest('real_sort_adjointes_${namei}$', test_real_sort_adjointes_${namei}$), & @@ -219,6 +237,7 @@ contains string_rand(index1) = string_temp end do + #:if WITH_BITSETS do i = 0, bitset_size-1 write(bin32,'(b32.32)') i call bitsetl_increase(i)%from_string(bin32) @@ -252,6 +271,7 @@ contains bitset64_rand(i) = bitset64_rand(index1) bitset64_rand(index1) = bitset64_temp end do + #:endif ! Create and intialize file to report the results of the sortings open( newunit=lun, file=filename, access='sequential', action='write', & @@ -533,6 +553,7 @@ contains end subroutine test_string_ord_sort +#:if WITH_BITSETS subroutine test_bitsetl_ord_sorts(error) !> Error handling type(error_type), allocatable, intent(out) :: error @@ -706,6 +727,7 @@ contains end if end subroutine test_bitset64_ord_sort +#:endif subroutine test_int_radix_sorts(error) !> Error handling @@ -1088,6 +1110,7 @@ contains end subroutine test_string_sort +#:if WITH_BITSETS subroutine test_bitsetl_sorts(error) !> Error handling type(error_type), allocatable, intent(out) :: error @@ -1227,6 +1250,7 @@ contains bin_im1, bin_i end if end subroutine test_bitset64_sort +#:endif #:for ki, ti, namei in INT_INDEX_TYPES_ALT_NAME subroutine test_int_sort_indexes_${namei}$(error) @@ -1440,6 +1464,7 @@ contains end subroutine test_string_sort_index_${namei}$ +#:if WITH_BITSETS subroutine test_bitsetl_sort_indexes_${namei}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error @@ -1553,6 +1578,7 @@ contains bitset_size, a_name, "Sort_Index", tdiff/rate end subroutine test_bitset64_sort_index_${namei}$ +#:endif #:endfor #:for ki, ti, namei in INT_TYPES_ALT_NAME @@ -1778,6 +1804,7 @@ contains end subroutine test_string_sort_adjoint_${namei}$ +#:if WITH_BITSETS subroutine test_bitsetl_sort_adjointes_${namei}$(error) !> Error handling type(error_type), allocatable, intent(out) :: error @@ -1897,6 +1924,7 @@ contains bitset_size, a_name, "Sort_adjoint", tdiff/rate end subroutine test_bitset64_sort_adjoint_${namei}$ +#:endif #:endfor #:for ki, ti, namei in REAL_TYPES_ALT_NAME @@ -2077,6 +2105,7 @@ contains end subroutine verify_string_sort +#:if WITH_BITSETS subroutine verify_bitsetl_sort( a, valid, i ) type(bitset_large), intent(in) :: a(0:) logical, intent(out) :: valid @@ -2108,6 +2137,7 @@ contains valid = .true. end subroutine verify_bitset64_sort +#:endif subroutine verify_char_sort( a, valid, i ) character(len=4), intent(in) :: a(0:) @@ -2189,6 +2219,7 @@ contains end subroutine verify_string_reverse_sort +#:if WITH_BITSETS subroutine verify_bitsetl_reverse_sort( a, valid, i ) type(bitset_large), intent(in) :: a(0:) logical, intent(out) :: valid @@ -2220,6 +2251,7 @@ contains valid = .true. end subroutine verify_bitset64_reverse_sort +#:endif end module test_sorting