Skip to content

Commit 16e0d40

Browse files
Adds frecursive to Travis; Tries allocating memory dinamically for TESTING/EIG/zchkee.f; Improves CMakeLists.txt
1 parent ebaba80 commit 16e0d40

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ script:
3939
-DLAPACKE:BOOL=ON
4040
-DBUILD_TESTING=ON
4141
-DLAPACKE_WITH_TMG:BOOL=ON
42-
-DCMAKE_Fortran_FLAGS:STRING="-fimplicit-none"
42+
-DCMAKE_Fortran_FLAGS:STRING="-fimplicit-none -frecursive"
4343
${SRC_DIR}
4444
- ctest -D ExperimentalStart
4545
- ctest -D ExperimentalConfigure

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,21 @@ check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
101101
# Add recursive flag
102102
if(_recursiveFlag)
103103
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
104-
if(NOT output_test)
105-
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
106-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive")
104+
if(NOT output_test)
105+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
106+
CACHE STRING "Recursive flag must be set" FORCE)
107107
endif()
108108
elseif(_frecursiveFlag)
109109
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
110110
if(NOT output_test)
111-
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
112-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive")
111+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
112+
CACHE STRING "Recursive flag must be set" FORCE)
113113
endif()
114114
elseif(_MrecursiveFlag)
115115
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
116-
if(NOT output_test)
117-
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
118-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive")
116+
if(NOT output_test)
117+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
118+
CACHE STRING "Recursive flag must be set" FORCE)
119119
endif()
120120
endif()
121121

TESTING/EIG/zchkee.f

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,12 +1084,17 @@ PROGRAM ZCHKEE
10841084
INTEGER INMIN( MAXIN ), INWIN( MAXIN ), INIBL( MAXIN ),
10851085
$ ISHFTS( MAXIN ), IACC22( MAXIN )
10861086
DOUBLE PRECISION ALPHA( NMAX ), BETA( NMAX ), DR( NMAX, 12 ),
1087-
$ RESULT( 500 ), RWORK( LWORK ), S( NMAX*NMAX )
1088-
COMPLEX*16 A( NMAX*NMAX, NEED ), B( NMAX*NMAX, 5 ),
1089-
$ C( NCMAX*NCMAX, NCMAX*NCMAX ), DC( NMAX, 6 ),
1090-
$ TAUA( NMAX ), TAUB( NMAX ), WORK( LWORK ),
1087+
$ RESULT( 500 )
1088+
COMPLEX*16 DC( NMAX, 6 ), TAUA( NMAX ), TAUB( NMAX ),
10911089
$ X( 5*NMAX )
10921090
* ..
1091+
* .. Allocatable Arrays ..
1092+
INTEGER AllocateStatus
1093+
DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: RWORK
1094+
DOUBLE PRECISION, DIMENSION(:,:), ALLOCATABLE :: S
1095+
COMPLEX*16, DIMENSION(:), ALLOCATABLE :: WORK
1096+
COMPLEX*16, DIMENSION(:,:), ALLOCATABLE :: A, B, C
1097+
* ..
10931098
* .. External Functions ..
10941099
LOGICAL LSAMEN
10951100
DOUBLE PRECISION DLAMCH, DSECND
@@ -1130,6 +1135,21 @@ PROGRAM ZCHKEE
11301135
DATA INTSTR / '0123456789' /
11311136
DATA IOLDSD / 0, 0, 0, 1 /
11321137
* ..
1138+
* .. Allocate memory dynamically ..
1139+
*
1140+
ALLOCATE ( S(NMAX,NMAX), STAT = AllocateStatus )
1141+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1142+
ALLOCATE ( A(NMAX,NMAX), STAT = AllocateStatus )
1143+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1144+
ALLOCATE ( B(NMAX,NMAX), STAT = AllocateStatus )
1145+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1146+
ALLOCATE ( C(NCMAX*NCMAX,NCMAX*NCMAX), STAT = AllocateStatus )
1147+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1148+
ALLOCATE ( RWORK(LWORK), STAT = AllocateStatus )
1149+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1150+
ALLOCATE ( WORK(LWORK), STAT = AllocateStatus )
1151+
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
1152+
* ..
11331153
* .. Executable Statements ..
11341154
*
11351155
A = 0.0
@@ -2435,6 +2455,13 @@ PROGRAM ZCHKEE
24352455
WRITE( NOUT, FMT = 9994 )
24362456
S2 = DSECND( )
24372457
WRITE( NOUT, FMT = 9993 )S2 - S1
2458+
*
2459+
DEALLOCATE (S, STAT = AllocateStatus)
2460+
DEALLOCATE (A, STAT = AllocateStatus)
2461+
DEALLOCATE (B, STAT = AllocateStatus)
2462+
DEALLOCATE (C, STAT = AllocateStatus)
2463+
DEALLOCATE (RWORK, STAT = AllocateStatus)
2464+
DEALLOCATE (WORK, STAT = AllocateStatus)
24382465
*
24392466
9999 FORMAT( / ' Execution not attempted due to input errors' )
24402467
9997 FORMAT( / / 1X, A3, ': NB =', I4, ', NBMIN =', I4, ', NX =', I4 )

0 commit comments

Comments
 (0)