(git:374b731)
Loading...
Searching...
No Matches
cp2k_info.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief some minimal info about CP2K, including its version and license
10!> \par History
11!> - created (2007-09, Joost VandeVondele)
12!> - moved into this module information related to runtime:pid, user_name,
13!> host_name, cwd, datx (2009-06, Teodoro Laino)
14!> \author Joost VandeVondele
15! **************************************************************************************************
17
18 USE kinds, ONLY: default_path_length,&
20 USE machine, ONLY: m_datum,&
21 m_getcwd,&
22 m_getlog,&
23 m_getpid,&
26
27 IMPLICIT NONE
28 PRIVATE
29
33
34#if defined(__COMPILE_REVISION)
35 CHARACTER(LEN=*), PARAMETER :: compile_revision = __compile_revision
36#else
37 CHARACTER(LEN=*), PARAMETER :: compile_revision = "unknown"
38#endif
39
40 !!! Keep version in sync with CMakeLists.txt !!!
41 CHARACTER(LEN=*), PARAMETER :: cp2k_version = "CP2K version 2024.1 (Development Version)"
42 CHARACTER(LEN=*), PARAMETER :: cp2k_year = "2024"
43 CHARACTER(LEN=*), PARAMETER :: cp2k_home = "https://www.cp2k.org/"
44
45 ! compile time information
46#if defined(__COMPILE_ARCH)
47 CHARACTER(LEN=*), PARAMETER :: compile_arch = __compile_arch
48#else
49 CHARACTER(LEN=*), PARAMETER :: compile_arch = "unknown: -D__COMPILE_ARCH=?"
50#endif
51
52#if defined(__COMPILE_DATE)
53 CHARACTER(LEN=*), PARAMETER :: compile_date = __compile_date
54#else
55 CHARACTER(LEN=*), PARAMETER :: compile_date = "unknown: -D__COMPILE_DATE=?"
56#endif
57
58#if defined(__COMPILE_HOST)
59 CHARACTER(LEN=*), PARAMETER :: compile_host = __compile_host
60#else
61 CHARACTER(LEN=*), PARAMETER :: compile_host = "unknown: -D__COMPILE_HOST=?"
62#endif
63
64 ! Local runtime informations
65 CHARACTER(LEN=26), PUBLIC :: r_datx
66 CHARACTER(LEN=default_path_length), PUBLIC :: r_cwd
67 CHARACTER(LEN=default_string_length), PUBLIC :: r_host_name, r_user_name
68 INTEGER, PUBLIC :: r_pid
69
70 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'cp2k_info'
71CONTAINS
72
73! **************************************************************************************************
74!> \brief list all compile time options that influence the capabilities of cp2k.
75!> All new flags should be added here (and be unique grep-able)
76!> \return ...
77! **************************************************************************************************
78 FUNCTION cp2k_flags() RESULT(flags)
79 CHARACTER(len=10*default_string_length) :: flags
80
81 CHARACTER(len=default_string_length) :: tmp_str
82
83 flags = "cp2kflags:"
84
85 ! Ensure that tmp_str is used to silence compiler warnings
86 tmp_str = ""
87 flags = trim(flags)//trim(tmp_str)
88
89!$ flags = TRIM(flags)//" omp"
90#if defined(__LIBINT)
91 flags = trim(flags)//" libint"
92#endif
93#if defined(__FFTW3)
94 flags = trim(flags)//" fftw3"
95#endif
96#if defined(__FFTW3_MKL)
97 flags = trim(flags)//" fftw3_mkl"
98#endif
99#if defined(__LIBXC)
100 flags = trim(flags)//" libxc"
101#endif
102#if defined(__LIBGRPP)
103 flags = trim(flags)//" libgrpp"
104#endif
105#if defined(__LIBPEXSI)
106 flags = trim(flags)//" pexsi"
107#endif
108#if defined(__ELPA)
109 flags = trim(flags)//" elpa"
110#endif
111#if defined(__ELPA_NVIDIA_GPU)
112 flags = trim(flags)//" elpa_nvidia_gpu"
113#endif
114#if defined(__ELPA_AMD_GPU)
115 flags = trim(flags)//" elpa_amd_gpu"
116#endif
117#if defined(__ELPA_INTEL_GPU)
118 flags = trim(flags)//" elpa_intel_gpu"
119#endif
120#if defined(__parallel)
121 flags = trim(flags)//" parallel"
122#endif
123#if defined(__MPI_F08)
124 flags = trim(flags)//" mpi_f08"
125#endif
126#if defined(__SCALAPACK)
127 flags = trim(flags)//" scalapack"
128#endif
129#if defined(__COSMA)
130 flags = trim(flags)//" cosma"
131#endif
132
133#if defined(__QUIP)
134 flags = trim(flags)//" quip"
135#endif
136
137#if defined(__HAS_PATCHED_CUFFT_70)
138 flags = trim(flags)//" patched_cufft_70"
139#endif
140
141#if defined(__DEEPMD)
142 flags = trim(flags)//" deepmd"
143#endif
144
145#if defined(__PW_FPGA)
146 flags = trim(flags)//" pw_fpga"
147#endif
148
149#if defined(__PW_FPGA_SP)
150 flags = trim(flags)//" pw_fpga_sp"
151#endif
152
153#if defined(__LIBXSMM)
154 flags = trim(flags)//" xsmm"
155#endif
156
157#if defined(__CRAY_PM_ACCEL_ENERGY)
158 flags = trim(flags)//" cray_pm_accel_energy"
159#endif
160#if defined(__CRAY_PM_ENERGY)
161 flags = trim(flags)//" cray_pm_energy"
162#endif
163#if defined(__CRAY_PM_FAKE_ENERGY)
164 flags = trim(flags)//" cray_pm_fake_energy"
165#endif
166#if defined(__DBCSR_ACC)
167 flags = trim(flags)//" dbcsr_acc"
168#endif
169#if defined(__MAX_CONTR)
170 CALL integer_to_string(__max_contr, tmp_str)
171 flags = trim(flags)//" max_contr="//trim(tmp_str)
172#endif
173#if defined(__NO_SOCKETS)
174 flags = trim(flags)//" no_sockets"
175#endif
176#if defined(__NO_MPI_THREAD_SUPPORT_CHECK)
177 flags = trim(flags)//" no_mpi_thread_support_check"
178#endif
179#if defined(__NO_STATM_ACCESS)
180 flags = trim(flags)//" no_statm_access"
181#endif
182#if defined(__MINGW)
183 flags = trim(flags)//" mingw"
184#endif
185#if defined(__PW_CUDA_NO_HOSTALLOC)
186 flags = trim(flags)//" pw_cuda_no_hostalloc"
187#endif
188#if defined(__STATM_RESIDENT)
189 flags = trim(flags)//" statm_resident"
190#endif
191#if defined(__STATM_TOTAL)
192 flags = trim(flags)//" statm_total"
193#endif
194#if defined(__PLUMED2)
195 flags = trim(flags)//" plumed2"
196#endif
197#if defined(__HAS_IEEE_EXCEPTIONS)
198 flags = trim(flags)//" has_ieee_exceptions"
199#endif
200#if defined(__NO_ABORT)
201 flags = trim(flags)//" no_abort"
202#endif
203#if defined(__SPGLIB)
204 flags = trim(flags)//" spglib"
205#endif
206#if defined(__ACCELERATE)
207 flags = trim(flags)//" accelerate"
208#endif
209#if defined(__MKL)
210 flags = trim(flags)//" mkl"
211#endif
212#if defined(__SIRIUS)
213 flags = trim(flags)//" sirius"
214#endif
215#if defined(__CHECK_DIAG)
216 flags = trim(flags)//" check_diag"
217#endif
218#if defined(__LIBVORI)
219 flags = trim(flags)//" libvori"
220 flags = trim(flags)//" libbqb"
221#endif
222#if defined(__LIBMAXWELL)
223 flags = trim(flags)//" libmaxwell"
224#endif
225#if defined(__LIBTORCH)
226 flags = trim(flags)//" libtorch"
227#endif
228#if defined(__OFFLOAD_CUDA)
229 flags = trim(flags)//" offload_cuda"
230#endif
231#if defined(__OFFLOAD_HIP)
232 flags = trim(flags)//" offload_hip"
233#endif
234#if defined(__OFFLOAD_OPENCL)
235 flags = trim(flags)//" offload_opencl"
236#endif
237#if defined(__NO_OFFLOAD_GRID)
238 flags = trim(flags)//" no_offload_grid"
239#endif
240#if defined(__NO_OFFLOAD_DBM)
241 flags = trim(flags)//" no_offload_dbm"
242#endif
243#if defined(__NO_OFFLOAD_PW)
244 flags = trim(flags)//" no_offload_pw"
245#endif
246#if defined(__OFFLOAD_PROFILING)
247 flags = trim(flags)//" offload_profiling"
248#endif
249
250#if defined(__SPLA) && defined(__OFFLOAD_GEMM)
251 flags = trim(flags)//" spla_gemm_offloading"
252#endif
253
254#if defined(__CUSOLVERMP)
255 flags = trim(flags)//" cusolvermp"
256#endif
257
258#if defined(__DLAF)
259 flags = trim(flags)//" dlaf"
260#endif
261
262#if defined(__LIBVDWXC)
263 flags = trim(flags)//" libvdwxc"
264#endif
265
266#if defined(__HDF5)
267 flags = trim(flags)//" hdf5"
268#endif
269
270#if defined(__OFFLOAD_UNIFIED_MEMORY)
271 flags = trim(flags)//" offload_unified_memory"
272#endif
273
274 END FUNCTION cp2k_flags
275
276! **************************************************************************************************
277!> \brief ...
278!> \param iunit ...
279! **************************************************************************************************
280 SUBROUTINE print_cp2k_license(iunit)
281
282 INTEGER :: iunit
283
284 WRITE (unit=iunit, fmt="(T2,A)") &
285 "******************************************************************************", &
286 "* *", &
287 "* CP2K: A general program to perform molecular dynamics simulations *", &
288 "* Copyright (C) 2000-2024 CP2K developer group <https://www.cp2k.org/> *", &
289 "* *", &
290 "* This program is free software: you can redistribute it and/or modify *", &
291 "* it under the terms of the GNU General Public License as published by *", &
292 "* the Free Software Foundation, either version 2 of the License, or *", &
293 "* (at your option) any later version. *", &
294 "* *", &
295 "* This program is distributed in the hope that it will be useful, *", &
296 "* but WITHOUT ANY WARRANTY; without even the implied warranty of *", &
297 "* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *", &
298 "* GNU General Public License for more details. *", &
299 "* *", &
300 "* You should have received a copy of the GNU General Public License *", &
301 "* along with this program. If not, see <https://www.gnu.org/licenses/>. *", &
302 "* *", &
303 "******************************************************************************"
304
305 END SUBROUTINE print_cp2k_license
306
307! **************************************************************************************************
308!> \brief ...
309! **************************************************************************************************
310 SUBROUTINE get_runtime_info()
311
312 r_datx = ""
313 r_cwd = ""
314 r_host_name = ""
315 r_user_name = ""
316 r_pid = -1
317
318 CALL m_getpid(r_pid)
321 CALL m_datum(r_datx)
322 CALL m_getcwd(r_cwd)
323
324 END SUBROUTINE
325
326! **************************************************************************************************
327!> \brief Writes the header for the restart file
328!> \param iunit ...
329!> \par History
330!> 01.2008 [created] - Split from write_restart
331!> \author Teodoro Laino - University of Zurich - 01.2008
332! **************************************************************************************************
333 SUBROUTINE write_restart_header(iunit)
334 INTEGER, INTENT(IN) :: iunit
335
336 CHARACTER(LEN=256) :: cwd, datx
337
338 CALL m_datum(datx)
339 CALL m_getcwd(cwd)
340
341 WRITE (unit=iunit, fmt="(T2,A)") "# Version information for this restart file "
342 WRITE (unit=iunit, fmt="(T2,A)") "# current date "//trim(datx)
343 WRITE (unit=iunit, fmt="(T2,A)") "# current working dir "//trim(cwd)
344
345 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
346 "# Program compiled at", &
347 adjustr(compile_date(1:min(50, len(compile_date))))
348 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
349 "# Program compiled on", &
350 adjustr(compile_host(1:min(50, len(compile_host))))
351 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
352 "# Program compiled for", &
353 adjustr(compile_arch(1:min(50, len(compile_arch))))
354 WRITE (unit=iunit, fmt="(T2,A,T31,A50)") &
355 "# Source code revision number", &
356 adjustr(compile_revision)
357
358 END SUBROUTINE write_restart_header
359
360END MODULE cp2k_info
some minimal info about CP2K, including its version and license
Definition cp2k_info.F:16
character(len=default_string_length), public r_host_name
Definition cp2k_info.F:67
character(len= *), parameter, public cp2k_home
Definition cp2k_info.F:43
character(len= *), parameter, public compile_host
Definition cp2k_info.F:61
character(len= *), parameter, public compile_arch
Definition cp2k_info.F:49
integer, public r_pid
Definition cp2k_info.F:68
subroutine, public print_cp2k_license(iunit)
...
Definition cp2k_info.F:281
subroutine, public write_restart_header(iunit)
Writes the header for the restart file.
Definition cp2k_info.F:334
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:37
character(len= *), parameter, public compile_date
Definition cp2k_info.F:55
character(len= *), parameter, public cp2k_year
Definition cp2k_info.F:42
character(len=10 *default_string_length) function, public cp2k_flags()
list all compile time options that influence the capabilities of cp2k. All new flags should be added ...
Definition cp2k_info.F:79
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:41
character(len=default_path_length), public r_cwd
Definition cp2k_info.F:66
subroutine, public get_runtime_info()
...
Definition cp2k_info.F:311
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:67
character(len=26), public r_datx
Definition cp2k_info.F:65
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_getpid(pid)
...
Definition machine.F:555
subroutine, public m_datum(cal_date)
returns a datum in human readable format using a standard Fortran routine
Definition machine.F:270
subroutine, public m_getcwd(curdir)
...
Definition machine.F:507
subroutine, public m_getlog(user)
...
Definition machine.F:632
subroutine, public m_hostnm(hname)
...
Definition machine.F:474
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...