Skip to content

addition of stdlib_experimental_stats mean #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add CMAKE_MAXIMUM_RANK
  • Loading branch information
jvdp1 committed Jan 24, 2020
commit 26f23a58de0ebf2b6e12f99a58d1f78354f73f71
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true

- name: Configure with CMake
run: cmake -Wdev -DCMAKE_BUILD_TYPE=Release -S . -B build
run: cmake -Wdev -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAXIMUM_RANK=5 -S . -B build

- name: Build and compile
run: cmake --build build
Expand All @@ -80,6 +80,6 @@ jobs:
- name: Test manual makefiles
if: contains(matrix.os, 'ubuntu') && contains(matrix.gcc_v, '9')
run: |
make -f Makefile.manual
make -f Makefile.manual FYPPFLAGS="-DMAXRANK=5"
make -f Makefile.manual test
make -f Makefile.manual clean
2 changes: 1 addition & 1 deletion .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install fypp
run: pip install fypp

- run: cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wdev -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace"
- run: cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wdev -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace" -DCMAKE_MAXIMUM_RANK=5

env:
FC: gfortran
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ check_fortran_source_compiles("error stop i; end" f18errorstop SRC_EXT f90)
check_fortran_source_compiles("real, allocatable :: array(:, :, :, :, :, :, :, :, :, :); end" f03rank SRC_EXT f90)
check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)

if(DEFINED CMAKE_MAXIMUM_RANK)
set(CMAKE_MAXIMUM_RANK ${CMAKE_MAXIMUM_RANK})
endif()

add_subdirectory(src)
32 changes: 19 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,25 @@ foreach(infileName IN LISTS fppFiles)
set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${infileName}")

# Custom command to do the processing
if(f03rank)
add_custom_command(
OUTPUT "${outfile}"
COMMAND fypp "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
VERBATIM)
else()
add_custom_command(
OUTPUT "${outfile}"
COMMAND fypp -DVERSION90 "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
VERBATIM)
endif()
if(DEFINED CMAKE_MAXIMUM_RANK)
add_custom_command(
OUTPUT "${outfile}"
COMMAND fypp -DMAXRANK=${CMAKE_MAXIMUM_RANK} "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
VERBATIM)
elseif(f03rank)
add_custom_command(
OUTPUT "${outfile}"
COMMAND fypp "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
VERBATIM)
else()
add_custom_command(
OUTPUT "${outfile}"
COMMAND fypp -DVERSION90 "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
VERBATIM)
endif()

# Finally add output file to a list
set(outFiles ${outFiles} "${outfile}")
Expand Down
4 changes: 3 additions & 1 deletion src/stdlib_experimental_stats.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ interface mean
#{if rank > 0}#(${":" + ",:" * (rank - 1)}$)#{endif}#
#:enddef

#:if VERSION90
#:if defined('MAXRANK')
#:set ranks = range(3,MAXRANK+1)
#:elif VERSION90
#:set ranks = range(3,8)
#:else
#:set ranks = range(3,16)
Expand Down
4 changes: 3 additions & 1 deletion src/stdlib_experimental_stats_mean.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ end function mean_2_${k1}$_dp
#{if rank > 0}#(${":" + ",:" * (rank - 1)}$)#{endif}#
#:enddef

#:if VERSION90
#:if defined('MAXRANK')
#:set ranks = range(3,MAXRANK+1)
#:elif VERSION90
#:set ranks = range(3,8)
#:else
#:set ranks = range(3,16)
Expand Down
8 changes: 6 additions & 2 deletions src/tests/stats/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ADDTEST(mean)

if(f03rank)
ADDTEST(mean_f03)
if(DEFINED CMAKE_MAXIMUM_RANK)
if(${CMAKE_MAXIMUM_RANK} GREATER 7)
ADDTEST(mean_f03)
endif()
elseif(f03rank)
ADDTEST(mean_f03)
endif()