mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 22:25:32 -04:00
Fix initialization of FFTW
This also fixes the import of wisdom files if they were created by CP2K.
This commit is contained in:
parent
933e21e4a2
commit
557af287e4
5 changed files with 106 additions and 5 deletions
|
|
@ -154,9 +154,8 @@ CONTAINS
|
|||
! only the ionode updates the wisdom
|
||||
IF (ionode) THEN
|
||||
iunit = get_unit_number()
|
||||
OPEN (UNIT=iunit, FILE=wisdom_file, STATUS="REPLACE", FORM="FORMATTED", ACTION="WRITE", IOSTAT=istat)
|
||||
OPEN (UNIT=iunit, FILE=wisdom_file, STATUS="UNKNOWN", FORM="FORMATTED", ACTION="WRITE", IOSTAT=istat)
|
||||
IF (istat == 0) THEN
|
||||
CLOSE (iunit)
|
||||
file_name_length = LEN_TRIM(wisdom_file)
|
||||
ALLOCATE (wisdom_file_name_c(file_name_length + 1))
|
||||
DO i = 1, file_name_length
|
||||
|
|
@ -166,7 +165,7 @@ CONTAINS
|
|||
isuccess = fftw_export_wisdom_to_filename(wisdom_file_name_c)
|
||||
IF (isuccess == 0) &
|
||||
CPABORT("Error exporting wisdom to file "//wisdom_file)
|
||||
WRITE (*, *) "Exported wisdom to file "//wisdom_file
|
||||
CLOSE (iunit)
|
||||
END IF
|
||||
END IF
|
||||
|
||||
|
|
@ -217,6 +216,10 @@ CONTAINS
|
|||
#include <mkl_version.h>
|
||||
#endif
|
||||
|
||||
isuccess = fftw_init_threads()
|
||||
IF (isuccess == 0) &
|
||||
CPABORT("Error initializing FFTW with threads")
|
||||
|
||||
! Read FFTW wisdom (if available)
|
||||
! all nodes are opening the file here...
|
||||
INQUIRE (FILE=wisdom_file, exist=file_exists)
|
||||
|
|
@ -229,8 +232,8 @@ CONTAINS
|
|||
wisdom_file_name_c(file_name_length + 1) = C_NULL_CHAR
|
||||
isuccess = fftw_import_wisdom_from_filename(wisdom_file_name_c)
|
||||
IF (isuccess == 0) &
|
||||
CPABORT("Error importing wisdom from file "//wisdom_file)
|
||||
WRITE (*, *) "Imported wisdom to file "//wisdom_file
|
||||
CALL cp_abort(__LOCATION__, "Error importing wisdom from file "//wisdom_file//". "// &
|
||||
"Maybe the was created with a different configuration than CP2K is run with.")
|
||||
END IF
|
||||
|
||||
#if defined (__MKL)
|
||||
|
|
|
|||
3
tests/QS/regtest-fftw-wisdom/TEST_FILES
Normal file
3
tests/QS/regtest-fftw-wisdom/TEST_FILES
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
test_wisdom_export.inp 11 2e-13 -1.088792073500891
|
||||
test_wisdom_import.inp 11 2e-13 -1.088792073500891
|
||||
#EOF
|
||||
47
tests/QS/regtest-fftw-wisdom/test_wisdom_export.inp
Normal file
47
tests/QS/regtest-fftw-wisdom/test_wisdom_export.inp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
&GLOBAL
|
||||
FFTW_PLAN_TYPE PATIENT
|
||||
FFTW_WISDOM_FILE_NAME ./wisdom
|
||||
PREFERRED_FFT_LIBRARY FFTW3
|
||||
PRINT_LEVEL MEDIUM
|
||||
PROJECT test_wisdom_export
|
||||
RUN_TYPE ENERGY
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD Quickstep
|
||||
&DFT
|
||||
BASIS_SET_FILE_NAME BASIS_MOLOPT
|
||||
POTENTIAL_FILE_NAME GTH_POTENTIALS
|
||||
&MGRID
|
||||
CUTOFF 100
|
||||
REL_CUTOFF 30
|
||||
&END MGRID
|
||||
&QS
|
||||
EPS_DEFAULT 1.0E-7
|
||||
&END QS
|
||||
&SCF
|
||||
EPS_SCF 1.0E-6
|
||||
&END SCF
|
||||
&XC
|
||||
&XC_FUNCTIONAL PADE
|
||||
&END XC_FUNCTIONAL
|
||||
&END XC
|
||||
&END DFT
|
||||
&SUBSYS
|
||||
&CELL
|
||||
ABC 4.0 3.0 3.0
|
||||
MULTIPLE_UNIT_CELL 1 1 1
|
||||
&END CELL
|
||||
&COORD
|
||||
H 0.0 0.0 0.0 H
|
||||
H 0.8 0.0 0.0 H
|
||||
&END COORD
|
||||
&KIND H
|
||||
BASIS_SET SZV-MOLOPT-GTH
|
||||
POTENTIAL GTH-PADE-q1
|
||||
&END KIND
|
||||
&TOPOLOGY
|
||||
MULTIPLE_UNIT_CELL 1 1 1
|
||||
&END TOPOLOGY
|
||||
&END SUBSYS
|
||||
&END FORCE_EVAL
|
||||
47
tests/QS/regtest-fftw-wisdom/test_wisdom_import.inp
Normal file
47
tests/QS/regtest-fftw-wisdom/test_wisdom_import.inp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
&GLOBAL
|
||||
FFTW_PLAN_TYPE PATIENT
|
||||
FFTW_WISDOM_FILE_NAME ./wisdom
|
||||
PREFERRED_FFT_LIBRARY FFTW3
|
||||
PRINT_LEVEL MEDIUM
|
||||
PROJECT test_wisdom_export
|
||||
RUN_TYPE ENERGY
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD Quickstep
|
||||
&DFT
|
||||
BASIS_SET_FILE_NAME BASIS_MOLOPT
|
||||
POTENTIAL_FILE_NAME GTH_POTENTIALS
|
||||
&MGRID
|
||||
CUTOFF 100
|
||||
REL_CUTOFF 30
|
||||
&END MGRID
|
||||
&QS
|
||||
EPS_DEFAULT 1.0E-7
|
||||
&END QS
|
||||
&SCF
|
||||
EPS_SCF 1.0E-6
|
||||
&END SCF
|
||||
&XC
|
||||
&XC_FUNCTIONAL PADE
|
||||
&END XC_FUNCTIONAL
|
||||
&END XC
|
||||
&END DFT
|
||||
&SUBSYS
|
||||
&CELL
|
||||
ABC 4.0 3.0 3.0
|
||||
MULTIPLE_UNIT_CELL 1 1 1
|
||||
&END CELL
|
||||
&COORD
|
||||
H 0.0 0.0 0.0 H
|
||||
H 0.8 0.0 0.0 H
|
||||
&END COORD
|
||||
&KIND H
|
||||
BASIS_SET SZV-MOLOPT-GTH
|
||||
POTENTIAL GTH-PADE-q1
|
||||
&END KIND
|
||||
&TOPOLOGY
|
||||
MULTIPLE_UNIT_CELL 1 1 1
|
||||
&END TOPOLOGY
|
||||
&END SUBSYS
|
||||
&END FORCE_EVAL
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
# Directories have been reordered according the execution time needed for a gfortran pdbg run using 2 MPI tasks
|
||||
# in case a new directory is added just add it at the top of the list..
|
||||
# the order will be regularly checked and modified...
|
||||
QS/regtest-fftw-wisdom fftw3
|
||||
Fist/regtest-water
|
||||
QS/regtest-ecp libgrpp
|
||||
QS/regtest-ecp-2 libgrpp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue