Skip to content

Commit 369ea33

Browse files
committed
compiler pass roundup
1 parent d62974c commit 369ea33

File tree

15 files changed

+73
-54
lines changed

15 files changed

+73
-54
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ image:
44

55
environment:
66
MINGW_DIR: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin
7-
CMAKE_GENERATOR: "MinGW Makefiles"
87

98
clone_depth: 3
109

1110
build: off
1211

1312
init:
1413
- cmd: set PATH=%MINGW_DIR%;%PATH%
14+
- cmd: set CMAKE_GENERATOR="MinGW Makefiles"
1515
- sh: sudo apt install -yq --no-install-recommends libscalapack-openmpi-dev libopenmpi-dev openmpi-bin
1616

1717
install:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[![Build Status](https://dev.azure.com/mhirsch0512/fortran2018-examples/_apis/build/status/scivision.fortran2018-examples?branchName=master)](https://dev.azure.com/mhirsch0512/fortran2018-examples/_build/latest?definitionId=8&branchName=master)
2-
[![image](https://travis-ci.org/scivision/fortran2018-examples.svg?branch=master)](https://travis-ci.org/scivision/fortran2018-examples)
3-
[![image](https://ci.appveyor.com/api/projects/status/kk2gcmlw1l3pjxy5?svg=true)](https://ci.appveyor.com/project/scivision/fortran2018-examples)
42

53

64
# Fortran 2018 Examples

azure-pipelines.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ jobs:
33
- job: Ubuntu
44
pool:
55
vmImage: ubuntu-latest
6-
76
steps:
87
- task: UsePythonVersion@0
98
inputs:
@@ -12,25 +11,26 @@ jobs:
1211
- script: |
1312
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
1413
sudo apt update -q
15-
sudo apt install -yq --no-install-recommends gfortran-6
14+
sudo apt install -yq --no-install-recommends gcc-6 gfortran-6 g++-6
1615
curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip -o ninja-linux.zip
1716
sudo unzip ninja-linux.zip -d /usr/local/bin/
1817
python -m pip install meson
1918
displayName: 'Install Prereqs'
2019
- script: meson setup build
2120
env:
2221
FC: gfortran-6
22+
CC: gcc-6
23+
CXX: g++-6
2324
displayName: 'Configure build'
2425
- script: meson test -C build
2526
displayName: 'build and test'
2627
- publish: build/meson-logs/testlog.txt
2728
condition: succeededOrFailed()
2829
artifact: LinuxMesonTestLog
2930

30-
- job: MacOS
31+
- job: MacMeson
3132
pool:
3233
vmImage: macOS-latest
33-
3434
steps:
3535
- task: UsePythonVersion@0
3636
inputs:
@@ -46,10 +46,9 @@ jobs:
4646
condition: succeededOrFailed()
4747
artifact: MacMesonTestLog
4848

49-
- job: WindowsMinGW
49+
- job: WindowsMeson
5050
pool:
5151
vmImage: windows-latest
52-
5352
steps:
5453
- task: UsePythonVersion@0
5554
inputs:
@@ -65,4 +64,20 @@ jobs:
6564
displayName: 'build and test'
6665
- publish: build/meson-logs/testlog.txt
6766
condition: succeededOrFailed()
68-
artifact: WindowsMesonTestLog
67+
artifact: WindowsMesonTestLog
68+
69+
- job: WindowsCMake
70+
pool:
71+
vmImage: windows-latest
72+
steps:
73+
- script: cinst -y mingw cmake
74+
displayName: 'Install Prereqs'
75+
- script: cmake -B build
76+
displayName: 'Configure build'
77+
env:
78+
CMAKE_GENERATOR: "MinGW Makefiles"
79+
- script: cmake --build build --parallel
80+
displayName: build
81+
- script: ctest --parallel -V
82+
displayName: run tests
83+
workingDirectory: build

coarray/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ if(NOT Coarray_FOUND)
1010
return()
1111
endif()
1212

13+
# "sync all" call is necessary to actually verify dynamically linked MPI stack works.
1314
include(CheckFortranSourceRuns)
1415
set(CMAKE_REQUIRED_FLAGS ${Coarray_COMPILE_OPTIONS})
1516
set(CMAKE_REQUIRED_LIBRARIES ${Coarray_LIBRARY})
16-
check_fortran_source_runs("real :: x[*]; end"
17+
check_fortran_source_runs("sync all; end"
1718
f08coarray SRC_EXT f90)
1819
if(NOT f08coarray)
1920
return()
2021
endif()
21-
check_fortran_source_runs("real :: x[*]; call co_sum(x); end"
22+
check_fortran_source_runs("real :: x[*]; call co_sum(x); sync all; end"
2223
f18coarray SRC_EXT f90)
2324

2425

@@ -27,7 +28,7 @@ target_compile_options(coarray_hello PRIVATE ${FFLAGS} ${Coarray_COMPILE_OPTIONS
2728
target_link_libraries(coarray_hello PRIVATE ${FLIBS} ${Coarray_LIBRARIES})
2829
add_test(NAME CoarrayHello
2930
COMMAND ${Coarray_EXECUTABLE} ${Coarray_NUMPROC_FLAG} ${Coarray_MAX_NUMPROCS} $<TARGET_FILE:coarray_hello>)
30-
31+
set_tests_properties(CoarrayHello PROPERTIES TIMEOUT 20 RUN_SERIAL TRUE)
3132

3233
if(f18coarray)
3334
add_executable(coarray_pi pi.f90)
@@ -39,4 +40,4 @@ target_compile_options(coarray_pi PRIVATE ${FFLAGS} ${Coarray_COMPILE_OPTIONS})
3940
target_link_libraries(coarray_pi PRIVATE ${FLIBS} ${Coarray_LIBRARIES})
4041
add_test(NAME CoarrayPi
4142
COMMAND ${Coarray_EXECUTABLE} ${Coarray_NUMPROC_FLAG} ${Coarray_MAX_NUMPROCS} $<TARGET_FILE:coarray_pi>)
42-
43+
set_tests_properties(CoarrayPi PROPERTIES TIMEOUT 20 RUN_SERIAL TRUE)

coarray/meson.build

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ if not coarray.found()
33
subdir_done()
44
endif
55

6+
coarray_ok = fc.run('sync all; end', dependencies: coarray, name:'Coarray runs').returncode() == 0
7+
if not coarray_ok
8+
subdir_done()
9+
endif
10+
611
# this needs to be "run" to verify no dll runtime issues, particularly on Windows.
7-
f18coarray = fc.run('real :: x[*]; call co_sum(x); end', dependencies: coarray, name: 'F2018 coarray').returncode() == 0
12+
f18coarray = fc.run('real :: x[*]; call co_sum(x); sync all; end', dependencies: coarray, name: 'F2018 coarray').returncode() == 0
813

914
hello = executable('coarray_hello', 'helloworld.f90',
1015
dependencies : coarray)
11-
test('Coarray Hello', hello)
16+
test('Coarray Hello', hello, timeout: 20, is_parallel : false)
1217

1318

1419
# Intel >= 20 supports Fortran 2018 co_sum
@@ -18,4 +23,4 @@ else
1823
pi = executable('coarray_pi', 'pi2008.f90', dependencies : coarray)
1924
endif
2025

21-
test('Coarray Pi', pi)
26+
test('Coarray Pi', pi, timeout: 20, is_parallel : false)

coarray/pi.f90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
! print *,x,f,psum
4242
end do
4343

44-
! --- co_sum is much simpler, but not included even in ifort 2019
45-
call co_sum(psum)!, stat=stat,errmsg=emsg)
44+
call co_sum(psum)!, stat=stat, errmsg=emsg)
4645
!if (stat /= 0) then
4746
! write (stderr,*) emsg
4847
! error stop
@@ -56,7 +55,7 @@
5655
if (im == 1) then
5756
call system_clock(toc)
5857
call system_clock(count_rate=rate)
59-
telaps = real((toc - tic),wp) / rate
58+
telaps = real((toc - tic), wp) / rate
6059
print '(A,E9.3,A,I3,A)', 'Elapsed wall clock time ', telaps, ' seconds, using',num_images(),' images.'
6160
end if
6261

contiguous/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
if fc.get_id() == 'intel-cl'
2+
message('Intel Fortran on Windows has a continuous bug')
3+
subdir_done()
4+
endif
5+
16
if fc.links('contig = is_contiguous([1,2,3]); end', name: 'F2008 contiguous')
27
f08contig='-DISCONTIG'
38
else

cxx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ target_compile_options(f_call_c PRIVATE ${FFLAGS})
2222
add_test(NAME Fortran2C COMMAND f_call_c)
2323

2424
# Workaround for PGI not having CXX on Windows and wrong CXX compiler being found
25-
if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL PGI)
25+
if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL PGI OR CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
2626
message(STATUS "PGI on Windows does not currently have a CXX compiler")
2727
return()
2828
endif()

io/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
add_library(logging logging.f90)
22
target_compile_options(logging PRIVATE ${FFLAGS})
33

4-
add_executable(append_file append_file.f90)
5-
target_compile_options(append_file PRIVATE ${FFLAGS})
6-
target_link_libraries(append_file PRIVATE logging)
7-
add_test(NAME AppendFile COMMAND append_file)
4+
if(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
5+
message(STATUS "PGI doesn't work correctly for this append_file example, even alone")
6+
else()
7+
add_executable(append_file append_file.f90)
8+
target_compile_options(append_file PRIVATE ${FFLAGS})
9+
target_link_libraries(append_file PRIVATE logging)
10+
add_test(NAME AppendFile COMMAND append_file)
11+
endif()
812

913
add_executable(termio terminal_io.f90)
1014
target_compile_options(termio PRIVATE ${FFLAGS})

lapack95/CMakeLists.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
cmake_minimum_required (VERSION 3.12)
2-
if(NOT CMAKE_BUILD_TYPE)
3-
set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release")
1+
if(WIN32 AND CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
2+
message(STATUS "skipping: PGI Lapack is buggy on Windows")
3+
return()
44
endif()
5-
project(fortran2018array C Fortran) # C is necessary for MKL detection!
6-
enable_testing()
7-
8-
cmake_policy(SET CMP0074 NEW)
9-
10-
get_directory_property(hasParent PARENT_DIRECTORY)
11-
if(NOT hasParent)
12-
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/compilers.cmake)
13-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/)
14-
endif()
15-
165

176
if(DEFINED ENV{MKLROOT})
187
set(USEMKL 1)
@@ -22,7 +11,6 @@ else()
2211
find_package(LAPACK COMPONENTS LAPACK95)
2312
endif()
2413

25-
2614
if(LAPACK_LAPACK95_FOUND)
2715
add_executable(svd demo_gesvd.F90)
2816
target_link_libraries(svd PRIVATE ${LAPACK_LIBRARIES} ${FLIBS})

0 commit comments

Comments
 (0)