Skip to content

Commit 57cfaf0

Browse files
authored
Merge pull request #565 from awvwgk/kinds
Make support for quadruple precision optional
2 parents 6033397 + d09b639 commit 57cfaf0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+391
-142
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ jobs:
2121
matrix:
2222
os: [ubuntu-latest, macos-latest]
2323
gcc_v: [9, 10, 11] # Version of GFortran we want to use.
24+
build: [cmake]
25+
include:
26+
- os: ubuntu-latest
27+
gcc_v: 10
28+
build: cmake-inline
29+
- os: ubuntu-latest
30+
gcc_v: 10
31+
build: make
2432
env:
2533
FC: gfortran-${{ matrix.gcc_v }}
2634
GCC_V: ${{ matrix.gcc_v }}
35+
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
2736

2837
steps:
2938
- name: Checkout code
@@ -58,35 +67,32 @@ jobs:
5867
brew link gcc@${GCC_V}
5968
6069
- name: Configure with CMake
70+
if: ${{ contains(matrix.build, 'cmake') }}
6171
run: >-
6272
cmake -Wdev
6373
-DCMAKE_BUILD_TYPE=Release
6474
-DCMAKE_MAXIMUM_RANK:String=4
6575
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
66-
-S . -B build
76+
-S . -B ${{ env.BUILD_DIR }}
6777
6878
- name: Build and compile
69-
run: cmake --build build --parallel
79+
if: ${{ contains(matrix.build, 'cmake') }}
80+
run: cmake --build ${{ env.BUILD_DIR }} --parallel
7081

7182
- name: catch build fail
72-
run: cmake --build build --verbose --parallel 1
73-
if: failure()
83+
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1
84+
if: ${{ failure() && contains(matrix.build, 'cmake') }}
7485

7586
- name: test
76-
run: ctest --test-dir build --parallel --output-on-failure
87+
if: ${{ contains(matrix.build, 'cmake') }}
88+
run: ctest --test-dir ${{ env.BUILD_DIR }} --parallel --output-on-failure
7789

7890
- name: Install project
79-
run: cmake --install build
80-
81-
- name: Test in-tree builds
82-
if: contains( matrix.gcc_v, '10') # Only test one compiler on each platform
83-
run: |
84-
cmake -DCMAKE_MAXIMUM_RANK=4 .
85-
cmake --build .
86-
cmake --build . --target test
91+
if: ${{ contains(matrix.build, 'cmake') }}
92+
run: cmake --install ${{ env.BUILD_DIR }}
8793

8894
- name: Test manual makefiles
89-
if: contains(matrix.os, 'ubuntu') && contains(matrix.gcc_v, '10')
95+
if: ${{ matrix.build == 'make' }}
9096
run: |
9197
make -f Makefile.manual FYPPFLAGS="-DMAXRANK=4" -j
9298
make -f Makefile.manual test

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2424
add_compile_options(-Wall)
2525
add_compile_options(-Wextra)
2626
add_compile_options(-Wimplicit-procedure)
27-
add_compile_options(-Wconversion-extra)
2827
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
2928
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
3029
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)

ci/fpm-deployment.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ fypp="${FYPP:-$(which fypp)}"
1212
fyflags="${FYFLAGS:--DMAXRANK=4}"
1313

1414
# Number of parallel jobs for preprocessing
15-
njob="$(nproc)"
15+
if [ $(uname) = "Darwin" ]; then
16+
njob="$(sysctl -n hw.ncpu)"
17+
else
18+
njob="$(nproc)"
19+
fi
1620

1721
# Additional files to include
1822
include=(

ci/fpm.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ copyright = "2019-2021 stdlib contributors"
77

88
[dev-dependencies]
99
test-drive.git = "https://github.com/fortran-lang/test-drive"
10+
test-drive.tag = "v0.4.0"

config/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ endif()
1313
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1414
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
1515

16+
# Check for available features
17+
# Note: users can overwrite the automatic check by setting the value at configure time
18+
include(CheckFortranSourceRuns)
19+
if (NOT DEFINED WITH_QP)
20+
check_fortran_source_runs(
21+
"if (selected_real_kind(33) == -1) stop 1; end"
22+
WITH_QP
23+
)
24+
set(WITH_QP ${WITH_QP} PARENT_SCOPE)
25+
endif()
26+
if (NOT DEFINED WITH_XDP)
27+
check_fortran_source_runs(
28+
"if (any(selected_real_kind(18) == [-1, selected_real_kind(33)])) stop 1; end"
29+
WITH_XDP
30+
)
31+
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
32+
endif()
33+
1634
# Export a pkg-config file
1735
configure_file(
1836
"${CMAKE_CURRENT_SOURCE_DIR}/template.pc"

config/cmake/Findtest-drive.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ foreach(method ${${_pkg}_FIND_METHOD})
136136
FetchContent_Declare(
137137
"${_lib}"
138138
GIT_REPOSITORY "${_url}"
139-
GIT_TAG "HEAD"
139+
GIT_TAG "v0.4.0"
140140
)
141141
FetchContent_MakeAvailable("${_lib}")
142142

config/template.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@PACKAGE_INIT@
22

3+
set("@PROJECT_NAME@_WITH_QP" @WITH_QP@)
4+
set("@PROJECT_NAME@_WITH_XDP" @WITH_XDP@)
5+
36
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
47
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
58
endif()

doc/specs/stdlib_kinds.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ The `stdlib_kinds` module provides kind parameters for the Fortran intrinsic dat
1616

1717
### `sp`
1818

19-
Alias for intrinsic named constant `real32` imported from `iso_fortran_env`.
19+
Single precision real kind parameter.
20+
Provides real kind parameter for floating point numbers with a minimal precision of 6 significant digits.
2021

2122

2223
### `dp`
2324

24-
Alias for intrinsic named constant `real64` imported from `iso_fortran_env`.
25+
Double precision real kind parameter.
26+
Provides real kind parameter for floating point numbers with a minimal precision of 15 significant digits.
27+
28+
29+
### `xdp`
30+
31+
Extended double precision real kind parameter.
32+
Provides real kind parameter for floating point numbers with a minimal precision of 18 significant digits.
33+
If not available it has value `-1`.
2534

2635

2736
### `qp`
2837

29-
Alias for intrinsic named constant `real128` imported from `iso_fortran_env`.
38+
Quadruple precision real kind parameter.
39+
Provides real kind parameter for floating point numbers with a minimal precision of 33 significant digits.
40+
If not available it has value `-1`.
3041

3142

3243
### `int8`

src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(fppFiles
77
stdlib_bitsets_64.fypp
88
stdlib_bitsets_large.fypp
99
stdlib_io.fypp
10+
stdlib_kinds.fypp
1011
stdlib_linalg.fypp
1112
stdlib_linalg_diag.fypp
1213
stdlib_linalg_outer_product.fypp
@@ -50,11 +51,16 @@ else()
5051
set(fyppFlags "-DVERSION90")
5152
endif()
5253

54+
list(
55+
APPEND fyppFlags
56+
"-DWITH_QP=$<BOOL:${WITH_QP}>"
57+
"-DWITH_XDP=$<BOOL:${WITH_XDP}>"
58+
)
59+
5360
fypp_f90("${fyppFlags}" "${fppFiles}" outFiles)
5461

5562
set(SRC
5663
stdlib_error.f90
57-
stdlib_kinds.f90
5864
stdlib_logger.f90
5965
stdlib_system.F90
6066
stdlib_specialfunctions.f90

src/Makefile.manual

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SRCFYPP = \
44
stdlib_bitsets_large.fypp \
55
stdlib_bitsets.fypp \
66
stdlib_io.fypp \
7+
stdlib_kinds.fypp \
78
stdlib_linalg.fypp \
89
stdlib_linalg_diag.fypp \
910
stdlib_linalg_outer_product.fypp \
@@ -41,7 +42,6 @@ SRC = f18estop.f90 \
4142
stdlib_specialfunctions.f90 \
4243
stdlib_specialfunctions_legendre.f90 \
4344
stdlib_io.f90 \
44-
stdlib_kinds.f90 \
4545
stdlib_logger.f90 \
4646
stdlib_quadrature_gauss.f90 \
4747
stdlib_strings.f90 \

0 commit comments

Comments
 (0)