(git:9111030)
Loading...
Searching...
No Matches
library_tests.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Performance tests for basic tasks like matrix multiplies, copy, fft.
10!> \par History
11!> 30-Nov-2000 (JGH) added input
12!> 02-Jan-2001 (JGH) Parallel FFT
13!> 28-Feb-2002 (JGH) Clebsch-Gordon Coefficients
14!> 06-Jun-2003 (JGH) Real space grid test
15!> Eigensolver test (29.08.05,MK)
16!> \author JGH 6-NOV-2000
17! **************************************************************************************************
19
20 USE ai_coulomb_test, ONLY: eri_test
21 USE cell_methods, ONLY: cell_create,&
23 USE cell_types, ONLY: cell_release,&
29 USE cp_dbcsr_api, ONLY: dbcsr_reset_randmat_seed,&
30 dbcsr_run_tests
32 USE cp_files, ONLY: close_file,&
35 USE cp_fm_diag, ONLY: cp_fm_syevd,&
41 USE cp_fm_types, ONLY: cp_fm_create,&
53 USE dbm_tests, ONLY: dbm_run_tests
54 USE fft_tools, ONLY: bwfft,&
56 fwfft,&
57 fft3d,&
73 USE kinds, ONLY: dp
74 USE machine, ONLY: m_flush,&
76 USE mathconstants, ONLY: gaussi
82 USE parallel_rng_types, ONLY: uniform,&
84 USE pw_grid_types, ONLY: fullspace,&
85 halfspace,&
87 USE pw_grids, ONLY: pw_grid_create,&
89 USE pw_methods, ONLY: pw_transfer,&
91 USE pw_types, ONLY: pw_c1d_gs_type,&
94 USE realspace_grid_types, ONLY: &
99#include "./base/base_uses.f90"
100
101 IMPLICIT NONE
102
103 PRIVATE
104 PUBLIC :: lib_test
105
106 INTEGER :: runtest(100)
107 REAL(KIND=dp) :: max_memory
108 REAL(KIND=dp), PARAMETER :: threshold = 1.0e-8_dp
109 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'library_tests'
110
111CONTAINS
112
113! **************************************************************************************************
114!> \brief Master routine for tests
115!> \param root_section ...
116!> \param para_env ...
117!> \param globenv ...
118!> \par History
119!> none
120!> \author JGH 6-NOV-2000
121! **************************************************************************************************
122 SUBROUTINE lib_test(root_section, para_env, globenv)
123
124 TYPE(section_vals_type), POINTER :: root_section
125 TYPE(mp_para_env_type), POINTER :: para_env
126 TYPE(global_environment_type), POINTER :: globenv
127
128 CHARACTER(LEN=*), PARAMETER :: routinen = 'lib_test'
129
130 INTEGER :: handle, iw
131 LOGICAL :: explicit
132 TYPE(cp_logger_type), POINTER :: logger
133 TYPE(section_vals_type), POINTER :: cp_dbcsr_test_section, cp_fm_gemm_test_section, &
134 dbm_test_section, eigensolver_section, eri_mme_test_section, pw_transfer_section, &
135 rs_pw_transfer_section, shg_integrals_test_section
136
137 CALL timeset(routinen, handle)
138
139 logger => cp_get_default_logger()
140 iw = cp_print_key_unit_nr(logger, root_section, "TEST%PROGRAM_RUN_INFO", extension=".log")
141
142 IF (iw > 0) THEN
143 WRITE (iw, '(T2,79("*"))')
144 WRITE (iw, '(A,T31,A,T80,A)') ' *', ' PERFORMANCE TESTS ', '*'
145 WRITE (iw, '(T2,79("*"))')
146 END IF
147 !
148 CALL test_input(root_section, para_env)
149 !
150 IF (runtest(1) /= 0) CALL copy_test(para_env, iw)
151 !
152 IF (runtest(2) /= 0) CALL matmul_test(para_env, test_matmul=.true., test_dgemm=.false., iw=iw)
153 IF (runtest(5) /= 0) CALL matmul_test(para_env, test_matmul=.false., test_dgemm=.true., iw=iw)
154 !
155 IF (runtest(3) /= 0) CALL fft_test(para_env, iw, globenv%fftw_plan_type, &
156 globenv%fftw_wisdom_file_name)
157 !
158 IF (runtest(4) /= 0) CALL eri_test(iw)
159 !
160 IF (runtest(6) /= 0) CALL clebsch_gordon_test()
161 !
162 ! runtest 7 has been deleted and can be recycled
163 !
164 IF (runtest(8) /= 0) CALL mpi_perf_test(para_env, runtest(8), iw)
165 !
166 IF (runtest(10) /= 0) CALL validate_exp_minimax(runtest(10), iw)
167 !
168 IF (runtest(11) /= 0) CALL test_least_square_ft(runtest(11), iw)
169 !
170
171 rs_pw_transfer_section => section_vals_get_subs_vals(root_section, "TEST%RS_PW_TRANSFER")
172 CALL section_vals_get(rs_pw_transfer_section, explicit=explicit)
173 IF (explicit) THEN
174 CALL rs_pw_transfer_test(para_env, iw, globenv, rs_pw_transfer_section)
175 END IF
176
177 pw_transfer_section => section_vals_get_subs_vals(root_section, "TEST%PW_TRANSFER")
178 CALL section_vals_get(pw_transfer_section, explicit=explicit)
179 IF (explicit) THEN
180 CALL pw_fft_test(para_env, iw, globenv, pw_transfer_section)
181 END IF
182
183 cp_fm_gemm_test_section => section_vals_get_subs_vals(root_section, "TEST%CP_FM_GEMM")
184 CALL section_vals_get(cp_fm_gemm_test_section, explicit=explicit)
185 IF (explicit) THEN
186 CALL cp_fm_gemm_test(para_env, iw, cp_fm_gemm_test_section)
187 END IF
188
189 eigensolver_section => section_vals_get_subs_vals(root_section, "TEST%EIGENSOLVER")
190 CALL section_vals_get(eigensolver_section, explicit=explicit)
191 IF (explicit) THEN
192 CALL eigensolver_test(para_env, iw, eigensolver_section)
193 END IF
194
195 eri_mme_test_section => section_vals_get_subs_vals(root_section, "TEST%ERI_MME_TEST")
196 CALL section_vals_get(eri_mme_test_section, explicit=explicit)
197 IF (explicit) THEN
198 CALL cp_eri_mme_perf_acc_test(para_env, iw, eri_mme_test_section)
199 END IF
200
201 shg_integrals_test_section => section_vals_get_subs_vals(root_section, "TEST%SHG_INTEGRALS_TEST")
202 CALL section_vals_get(shg_integrals_test_section, explicit=explicit)
203 IF (explicit) THEN
204 CALL shg_integrals_perf_acc_test(iw, shg_integrals_test_section)
205 END IF
206
207 ! DBCSR tests
208 cp_dbcsr_test_section => section_vals_get_subs_vals(root_section, "TEST%CP_DBCSR")
209 CALL section_vals_get(cp_dbcsr_test_section, explicit=explicit)
210 IF (explicit) THEN
211 CALL cp_dbcsr_tests(para_env, iw, cp_dbcsr_test_section)
212 END IF
213
214 ! DBM tests
215 dbm_test_section => section_vals_get_subs_vals(root_section, "TEST%DBM")
216 CALL section_vals_get(dbm_test_section, explicit=explicit)
217 IF (explicit) THEN
218 CALL run_dbm_tests(para_env, iw, dbm_test_section)
219 END IF
220
221 CALL cp_print_key_finished_output(iw, logger, root_section, "TEST%PROGRAM_RUN_INFO")
222
223 CALL timestop(handle)
224
225 END SUBROUTINE lib_test
226
227! **************************************************************************************************
228!> \brief Reads input section &TEST ... &END
229!> \param root_section ...
230!> \param para_env ...
231!> \author JGH 30-NOV-2000
232!> \note
233!> I---------------------------------------------------------------------------I
234!> I SECTION: &TEST ... &END I
235!> I I
236!> I MEMORY max_memory I
237!> I COPY n I
238!> I MATMUL n I
239!> I FFT n I
240!> I ERI n I
241!> I PW_FFT n I
242!> I Clebsch-Gordon n I
243!> I RS_GRIDS n I
244!> I MPI n I
245!> I RNG n -> Parallel random number generator I
246!> I---------------------------------------------------------------------------I
247! **************************************************************************************************
248 SUBROUTINE test_input(root_section, para_env)
249 TYPE(section_vals_type), POINTER :: root_section
250 TYPE(mp_para_env_type), POINTER :: para_env
251
252 TYPE(section_vals_type), POINTER :: test_section
253
254!
255!..defaults
256! using this style is not recommended, introduce sections instead (see e.g. cp_fm_gemm)
257
258 runtest = 0
259 test_section => section_vals_get_subs_vals(root_section, "TEST")
260 CALL section_vals_val_get(test_section, "MEMORY", r_val=max_memory)
261 CALL section_vals_val_get(test_section, 'COPY', i_val=runtest(1))
262 CALL section_vals_val_get(test_section, 'MATMUL', i_val=runtest(2))
263 CALL section_vals_val_get(test_section, 'DGEMM', i_val=runtest(5))
264 CALL section_vals_val_get(test_section, 'FFT', i_val=runtest(3))
265 CALL section_vals_val_get(test_section, 'ERI', i_val=runtest(4))
266 CALL section_vals_val_get(test_section, 'CLEBSCH_GORDON', i_val=runtest(6))
267 CALL section_vals_val_get(test_section, 'MPI', i_val=runtest(8))
268 CALL section_vals_val_get(test_section, 'MINIMAX', i_val=runtest(10))
269 CALL section_vals_val_get(test_section, 'LEAST_SQ_FT', i_val=runtest(11))
270
271 CALL para_env%sync()
272 END SUBROUTINE test_input
273
274! **************************************************************************************************
275!> \brief Tests the performance to copy two vectors.
276!> \param para_env ...
277!> \param iw ...
278!> \par History
279!> none
280!> \author JGH 6-NOV-2000
281!> \note
282!> The results of these tests allow to determine the size of the cache
283!> of the CPU. This can be used to optimize the performance of the
284!> FFTSG library.
285! **************************************************************************************************
286 SUBROUTINE copy_test(para_env, iw)
287 TYPE(mp_para_env_type), POINTER :: para_env
288 INTEGER :: iw
289
290 INTEGER :: i, j, len, ntim, siz
291 REAL(kind=dp) :: perf, t, tend, tstart
292 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ca, cb
293
294! test for copy --> Cache size
295
296 siz = abs(runtest(1))
297 IF (para_env%is_source()) WRITE (iw, '(//,A,/)') " Test of copy ( F95 ) "
298 DO i = 6, 24
299 len = 2**i
300 IF (8.0_dp*real(len, kind=dp) > max_memory*0.5_dp) EXIT
301 ALLOCATE (ca(len))
302 ALLOCATE (cb(len))
303
304 CALL random_number(ca)
305 ntim = nint(1.e7_dp/real(len, kind=dp))
306 ntim = max(ntim, 1)
307 ntim = min(ntim, siz*10000)
308
309 tstart = m_walltime()
310 DO j = 1, ntim
311 cb(:) = ca(:)
312 ca(1) = real(j, kind=dp)
313 END DO
314 tend = m_walltime()
315 t = tend - tstart + threshold
316 IF (t > 0.0_dp) THEN
317 perf = real(ntim, kind=dp)*real(len, kind=dp)*1.e-6_dp/t
318 ELSE
319 perf = 0.0_dp
320 END IF
321
322 IF (para_env%is_source()) THEN
323 WRITE (iw, '(A,i2,i10,A,T59,F14.4,A)') " Copy test: Size = 2^", i, &
324 len/1024, " Kwords", perf, " Mcopy/s"
325 END IF
326
327 DEALLOCATE (ca)
328 DEALLOCATE (cb)
329 END DO
330 CALL para_env%sync()
331 END SUBROUTINE copy_test
332
333! **************************************************************************************************
334!> \brief Tests the performance of different kinds of matrix matrix multiply
335!> kernels for the BLAS and F95 intrinsic matmul.
336!> \param para_env ...
337!> \param test_matmul ...
338!> \param test_dgemm ...
339!> \param iw ...
340!> \par History
341!> none
342!> \author JGH 6-NOV-2000
343! **************************************************************************************************
344 SUBROUTINE matmul_test(para_env, test_matmul, test_dgemm, iw)
345 TYPE(mp_para_env_type), POINTER :: para_env
346 LOGICAL :: test_matmul, test_dgemm
347 INTEGER :: iw
348
349 INTEGER :: i, j, len, ntim, siz
350 REAL(kind=dp) :: perf, t, tend, tstart, xdum
351 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: ma, mb, mc
352
353! test for matrix multpies
354
355 IF (test_matmul) THEN
356 siz = abs(runtest(2))
357 IF (para_env%is_source()) WRITE (iw, '(//,A,/)') " Test of matmul ( F95 ) "
358 DO i = 5, siz, 2
359 len = 2**i + 1
360 IF (8.0_dp*real(len*len, kind=dp) > max_memory*0.3_dp) EXIT
361 ALLOCATE (ma(len, len))
362 ALLOCATE (mb(len, len))
363 ALLOCATE (mc(len, len))
364 mc = 0.0_dp
365
366 CALL random_number(xdum)
367 ma = xdum
368 CALL random_number(xdum)
369 mb = xdum
370 ntim = nint(1.e8_dp/(2.0_dp*real(len, kind=dp)**3))
371 ntim = max(ntim, 1)
372 ntim = min(ntim, siz*200)
373 tstart = m_walltime()
374 DO j = 1, ntim
375 mc(:, :) = matmul(ma, mb)
376 ma(1, 1) = real(j, kind=dp)
377 END DO
378 tend = m_walltime()
379 t = tend - tstart + threshold
380 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
381 IF (para_env%is_source()) THEN
382 WRITE (iw, '(A,i6,T59,F14.4,A)') &
383 " Matrix multiply test: c = a * b Size = ", len, perf, " Mflop/s"
384 END IF
385 tstart = m_walltime()
386 DO j = 1, ntim
387 mc(:, :) = mc + matmul(ma, mb)
388 ma(1, 1) = real(j, kind=dp)
389 END DO
390 tend = m_walltime()
391 t = tend - tstart + threshold
392 IF (t > 0.0_dp) THEN
393 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
394 ELSE
395 perf = 0.0_dp
396 END IF
397
398 IF (para_env%is_source()) THEN
399 WRITE (iw, '(A,i6,T59,F14.4,A)') &
400 " Matrix multiply test: a = a * b Size = ", len, perf, " Mflop/s"
401 END IF
402
403 tstart = m_walltime()
404 DO j = 1, ntim
405 mc(:, :) = mc + matmul(ma, transpose(mb))
406 ma(1, 1) = real(j, kind=dp)
407 END DO
408 tend = m_walltime()
409 t = tend - tstart + threshold
410 IF (t > 0.0_dp) THEN
411 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
412 ELSE
413 perf = 0.0_dp
414 END IF
415
416 IF (para_env%is_source()) THEN
417 WRITE (iw, '(A,i6,T59,F14.4,A)') &
418 " Matrix multiply test: c = a * b(T) Size = ", len, perf, " Mflop/s"
419 END IF
420
421 tstart = m_walltime()
422 DO j = 1, ntim
423 mc(:, :) = mc + matmul(transpose(ma), mb)
424 ma(1, 1) = real(j, kind=dp)
425 END DO
426 tend = m_walltime()
427 t = tend - tstart + threshold
428 IF (t > 0.0_dp) THEN
429 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
430 ELSE
431 perf = 0.0_dp
432 END IF
433
434 IF (para_env%is_source()) THEN
435 WRITE (iw, '(A,i6,T59,F14.4,A)') &
436 " Matrix multiply test: c = a(T) * b Size = ", len, perf, " Mflop/s"
437 END IF
438
439 DEALLOCATE (ma)
440 DEALLOCATE (mb)
441 DEALLOCATE (mc)
442 END DO
443 END IF
444
445 ! test for matrix multpies
446 IF (test_dgemm) THEN
447 siz = abs(runtest(5))
448 IF (para_env%is_source()) WRITE (iw, '(//,A,/)') " Test of matmul ( BLAS ) "
449 DO i = 5, siz, 2
450 len = 2**i + 1
451 IF (8.0_dp*real(len*len, kind=dp) > max_memory*0.3_dp) EXIT
452 ALLOCATE (ma(len, len))
453 ALLOCATE (mb(len, len))
454 ALLOCATE (mc(len, len))
455 mc = 0.0_dp
456
457 CALL random_number(xdum)
458 ma = xdum
459 CALL random_number(xdum)
460 mb = xdum
461 ntim = nint(1.e8_dp/(2.0_dp*real(len, kind=dp)**3))
462 ntim = max(ntim, 1)
463 ntim = min(ntim, 1000)
464
465 tstart = m_walltime()
466 DO j = 1, ntim
467 CALL dgemm("N", "N", len, len, len, 1.0_dp, ma, len, mb, len, 1.0_dp, mc, len)
468 END DO
469 tend = m_walltime()
470 t = tend - tstart + threshold
471 IF (t > 0.0_dp) THEN
472 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
473 ELSE
474 perf = 0.0_dp
475 END IF
476
477 IF (para_env%is_source()) THEN
478 WRITE (iw, '(A,i6,T59,F14.4,A)') &
479 " Matrix multiply test: c = a * b Size = ", len, perf, " Mflop/s"
480 END IF
481
482 tstart = m_walltime()
483 DO j = 1, ntim
484 CALL dgemm("N", "N", len, len, len, 1.0_dp, ma, len, mb, len, 1.0_dp, mc, len)
485 END DO
486 tend = m_walltime()
487 t = tend - tstart + threshold
488 IF (t > 0.0_dp) THEN
489 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
490 ELSE
491 perf = 0.0_dp
492 END IF
493
494 IF (para_env%is_source()) THEN
495 WRITE (iw, '(A,i6,T59,F14.4,A)') &
496 " Matrix multiply test: a = a * b Size = ", len, perf, " Mflop/s"
497 END IF
498
499 tstart = m_walltime()
500 DO j = 1, ntim
501 CALL dgemm("N", "T", len, len, len, 1.0_dp, ma, len, mb, len, 1.0_dp, mc, len)
502 END DO
503 tend = m_walltime()
504 t = tend - tstart + threshold
505 IF (t > 0.0_dp) THEN
506 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
507 ELSE
508 perf = 0.0_dp
509 END IF
510
511 IF (para_env%is_source()) THEN
512 WRITE (iw, '(A,i6,T59,F14.4,A)') &
513 " Matrix multiply test: c = a * b(T) Size = ", len, perf, " Mflop/s"
514 END IF
515
516 tstart = m_walltime()
517 DO j = 1, ntim
518 CALL dgemm("T", "N", len, len, len, 1.0_dp, ma, len, mb, len, 1.0_dp, mc, len)
519 END DO
520 tend = m_walltime()
521 t = tend - tstart + threshold
522 IF (t > 0.0_dp) THEN
523 perf = real(ntim, kind=dp)*2.0_dp*real(len, kind=dp)**3*1.e-6_dp/t
524 ELSE
525 perf = 0.0_dp
526 END IF
527
528 IF (para_env%is_source()) THEN
529 WRITE (iw, '(A,i6,T59,F14.4,A)') &
530 " Matrix multiply test: c = a(T) * b Size = ", len, perf, " Mflop/s"
531 END IF
532
533 DEALLOCATE (ma)
534 DEALLOCATE (mb)
535 DEALLOCATE (mc)
536 END DO
537 END IF
538
539 CALL para_env%sync()
540
541 END SUBROUTINE matmul_test
542
543! **************************************************************************************************
544!> \brief Tests the performance of all available FFT libraries for 3D FFTs
545!> \param para_env ...
546!> \param iw ...
547!> \param fftw_plan_type ...
548!> \param wisdom_file where FFTW3 should look to save/load wisdom
549!> \par History
550!> none
551!> \author JGH 6-NOV-2000
552! **************************************************************************************************
553 SUBROUTINE fft_test(para_env, iw, fftw_plan_type, wisdom_file)
554
555 TYPE(mp_para_env_type), POINTER :: para_env
556 INTEGER :: iw, fftw_plan_type
557 CHARACTER(LEN=*), INTENT(IN) :: wisdom_file
558
559 INTEGER, PARAMETER :: ndate(3) = [12, 48, 96]
560
561 INTEGER :: iall, it, j, len, n(3), ntim, radix_in, &
562 radix_out, siz, stat
563 COMPLEX(KIND=dp), DIMENSION(4, 4, 4) :: zz
564 COMPLEX(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :) :: ca, cb, cc
565 CHARACTER(LEN=7) :: method
566 REAL(kind=dp) :: flops, perf, scale, t, tdiff, tend, &
567 tstart
568 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: ra
569
570! test for 3d FFT
571
572 IF (para_env%is_source()) WRITE (iw, '(//,A,/)') " Test of 3D-FFT "
573 siz = abs(runtest(3))
574
575 DO iall = 1, 100
576 SELECT CASE (iall)
577 CASE DEFAULT
578 EXIT
579 CASE (1)
580 CALL init_fft("FFTSG", alltoall=.false., fftsg_sizes=.true., wisdom_file=wisdom_file, &
581 pool_limit=10, plan_style=fftw_plan_type)
582 method = "FFTSG "
583 CASE (2)
584 cycle
585 CASE (3)
586 CALL init_fft("FFTW3", alltoall=.false., fftsg_sizes=.true., wisdom_file=wisdom_file, &
587 pool_limit=10, plan_style=fftw_plan_type)
588 method = "FFTW3 "
589 END SELECT
590 n = 4
591 zz = 0.0_dp
592 CALL fft3d(fwfft, n, zz, status=stat)
593 IF (stat == 0) THEN
594 DO it = 1, 3
595 radix_in = ndate(it)
596 CALL fft_radix_operations(radix_in, radix_out, fft_radix_closest)
597 len = radix_out
598 n = len
599 IF (16.0_dp*real(len*len*len, kind=dp) > max_memory*0.5_dp) EXIT
600 ALLOCATE (ra(len, len, len))
601 ALLOCATE (ca(len, len, len))
602 CALL random_number(ra)
603 ca(:, :, :) = ra
604 CALL random_number(ra)
605 ca(:, :, :) = ca + gaussi*ra
606 flops = real(len**3, kind=dp)*15.0_dp*log(real(len, kind=dp))
607 ntim = nint(siz*1.e7_dp/flops)
608 ntim = max(ntim, 1)
609 ntim = min(ntim, 200)
610 scale = 1.0_dp/real(len**3, kind=dp)
611 tstart = m_walltime()
612 DO j = 1, ntim
613 CALL fft3d(fwfft, n, ca)
614 CALL fft3d(bwfft, n, ca)
615 END DO
616 tend = m_walltime()
617 t = tend - tstart + threshold
618 IF (t > 0.0_dp) THEN
619 perf = real(ntim, kind=dp)*2.0_dp*flops*1.e-6_dp/t
620 ELSE
621 perf = 0.0_dp
622 END IF
623
624 IF (para_env%is_source()) THEN
625 WRITE (iw, '(T2,A,A,i6,T59,F14.4,A)') &
626 adjustr(method), " test (in-place) Size = ", len, perf, " Mflop/s"
627 END IF
628 DEALLOCATE (ca)
629 DEALLOCATE (ra)
630 END DO
631 IF (para_env%is_source()) WRITE (iw, *)
632 ! test if input data is preserved
633 len = 24
634 n = len
635 ALLOCATE (ra(len, len, len))
636 ALLOCATE (ca(len, len, len))
637 ALLOCATE (cb(len, len, len))
638 ALLOCATE (cc(len, len, len))
639 CALL random_number(ra)
640 ca(:, :, :) = ra
641 CALL random_number(ra)
642 ca(:, :, :) = ca + gaussi*ra
643 cc(:, :, :) = ca
644 CALL fft3d(fwfft, n, ca, cb)
645 tdiff = maxval(abs(ca - cc))
646 IF (tdiff > 1.0e-12_dp) THEN
647 IF (para_env%is_source()) THEN
648 WRITE (iw, '(T2,A,A,A)') adjustr(method), " FWFFT ", &
649 " Input array is changed in out-of-place FFT !"
650 END IF
651 ELSE
652 IF (para_env%is_source()) THEN
653 WRITE (iw, '(T2,A,A,A)') adjustr(method), " FWFFT ", &
654 " Input array is not changed in out-of-place FFT !"
655 END IF
656 END IF
657 ca(:, :, :) = cc
658 CALL fft3d(bwfft, n, ca, cb)
659 tdiff = maxval(abs(ca - cc))
660 IF (tdiff > 1.0e-12_dp) THEN
661 IF (para_env%is_source()) THEN
662 WRITE (iw, '(T2,A,A,A)') adjustr(method), " BWFFT ", &
663 " Input array is changed in out-of-place FFT !"
664 END IF
665 ELSE
666 IF (para_env%is_source()) THEN
667 WRITE (iw, '(T2,A,A,A)') adjustr(method), " BWFFT ", &
668 " Input array is not changed in out-of-place FFT !"
669 END IF
670 END IF
671 IF (para_env%is_source()) WRITE (iw, *)
672
673 DEALLOCATE (ra)
674 DEALLOCATE (ca)
675 DEALLOCATE (cb)
676 DEALLOCATE (cc)
677 END IF
678 CALL finalize_fft(para_env, wisdom_file=wisdom_file)
679 END DO
680
681 END SUBROUTINE fft_test
682
683! **************************************************************************************************
684!> \brief test rs_pw_transfer performance
685!> \param para_env ...
686!> \param iw ...
687!> \param globenv ...
688!> \param rs_pw_transfer_section ...
689!> \author Joost VandeVondele
690!> 9.2008 Randomise rs grid [Iain Bethune]
691!> (c) The Numerical Algorithms Group (NAG) Ltd, 2008 on behalf of the HECToR project
692! **************************************************************************************************
693 SUBROUTINE rs_pw_transfer_test(para_env, iw, globenv, rs_pw_transfer_section)
694
695 TYPE(mp_para_env_type), POINTER :: para_env
696 INTEGER :: iw
697 TYPE(global_environment_type), POINTER :: globenv
698 TYPE(section_vals_type), POINTER :: rs_pw_transfer_section
699
700 CHARACTER(LEN=*), PARAMETER :: routinen = 'rs_pw_transfer_test'
701
702 INTEGER :: halo_size, handle, i_loop, n_loop, ns_max
703 INTEGER, DIMENSION(3) :: no, np
704 INTEGER, DIMENSION(:), POINTER :: i_vals
705 LOGICAL :: do_rs2pw
706 REAL(kind=dp) :: tend, tstart
707 TYPE(cell_type), POINTER :: box
708 TYPE(pw_grid_type), POINTER :: grid
709 TYPE(pw_r3d_rs_type) :: ca
710 TYPE(realspace_grid_desc_type), POINTER :: rs_desc
711 TYPE(realspace_grid_input_type) :: input_settings
712 TYPE(realspace_grid_type) :: rs_grid
713 TYPE(section_vals_type), POINTER :: rs_grid_section
714
715 CALL timeset(routinen, handle)
716
717 !..set fft lib
718 CALL init_fft(globenv%default_fft_library, alltoall=.false., fftsg_sizes=.true., &
719 pool_limit=globenv%fft_pool_scratch_limit, &
720 wisdom_file=globenv%fftw_wisdom_file_name, &
721 plan_style=globenv%fftw_plan_type)
722
723 ! .. set cell (should otherwise be irrelevant)
724 NULLIFY (box)
725 CALL cell_create(box)
726 box%hmat = reshape([20.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 20.0_dp, 0.0_dp, &
727 0.0_dp, 0.0_dp, 20.0_dp], [3, 3])
728 CALL init_cell(box)
729
730 ! .. grid type and pw_grid
731 NULLIFY (grid)
732 CALL section_vals_val_get(rs_pw_transfer_section, "GRID", i_vals=i_vals)
733 np = i_vals
734 CALL pw_grid_create(grid, para_env, box%hmat, grid_span=fullspace, npts=np, fft_usage=.true., iounit=iw)
735 no = grid%npts
736
737 CALL ca%create(grid)
738 CALL pw_zero(ca)
739
740 ! .. rs input setting type
741 CALL section_vals_val_get(rs_pw_transfer_section, "HALO_SIZE", i_val=halo_size)
742 rs_grid_section => section_vals_get_subs_vals(rs_pw_transfer_section, "RS_GRID")
743 ns_max = 2*halo_size + 1
744 CALL init_input_type(input_settings, ns_max, rs_grid_section, 1, [-1, -1, -1])
745
746 ! .. rs type
747 NULLIFY (rs_desc)
748 CALL rs_grid_create_descriptor(rs_desc, pw_grid=grid, input_settings=input_settings)
749 CALL rs_grid_create(rs_grid, rs_desc)
750 CALL rs_grid_print(rs_grid, iw)
751 CALL rs_grid_zero(rs_grid)
752
753 ! Put random values on the grid, so summation check will pick up errors
754 CALL random_number(rs_grid%r)
755
756 CALL section_vals_val_get(rs_pw_transfer_section, "N_loop", i_val=n_loop)
757 CALL section_vals_val_get(rs_pw_transfer_section, "RS2PW", l_val=do_rs2pw)
758
759 ! go for the real loops, sync to get max timings
760 IF (para_env%is_source()) THEN
761 WRITE (iw, '(T2,A)') ""
762 WRITE (iw, '(T2,A)') "Timing rs_pw_transfer routine"
763 WRITE (iw, '(T2,A)') ""
764 WRITE (iw, '(T2,A)') "iteration time[s]"
765 END IF
766 DO i_loop = 1, n_loop
767 CALL para_env%sync()
768 tstart = m_walltime()
769 IF (do_rs2pw) THEN
770 CALL transfer_rs2pw(rs_grid, ca)
771 ELSE
772 CALL transfer_pw2rs(rs_grid, ca)
773 END IF
774 CALL para_env%sync()
775 tend = m_walltime()
776 IF (para_env%is_source()) THEN
777 WRITE (iw, '(T2,I9,1X,F12.6)') i_loop, tend - tstart
778 END IF
779 END DO
780
781 !cleanup
782 CALL rs_grid_release(rs_grid)
783 CALL rs_grid_release_descriptor(rs_desc)
784 CALL ca%release()
785 CALL pw_grid_release(grid)
786 CALL cell_release(box)
787 CALL finalize_fft(para_env, wisdom_file=globenv%fftw_wisdom_file_name)
788
789 CALL timestop(handle)
790
791 END SUBROUTINE rs_pw_transfer_test
792
793! **************************************************************************************************
794!> \brief Tests the performance of PW calls to FFT routines
795!> \param para_env ...
796!> \param iw ...
797!> \param globenv ...
798!> \param pw_transfer_section ...
799!> \par History
800!> JGH 6-Feb-2001 : Test and performance code
801!> Made input sensitive [Joost VandeVondele]
802!> \author JGH 1-JAN-2001
803! **************************************************************************************************
804 SUBROUTINE pw_fft_test(para_env, iw, globenv, pw_transfer_section)
805
806 TYPE(mp_para_env_type), POINTER :: para_env
807 INTEGER :: iw
808 TYPE(global_environment_type), POINTER :: globenv
809 TYPE(section_vals_type), POINTER :: pw_transfer_section
810
811 REAL(kind=dp), PARAMETER :: toler = 1.e-11_dp
812
813 INTEGER :: blocked_id, grid_span, i_layout, i_rep, &
814 ig, ip, itmp, n_loop, n_rep, nn, p, q
815 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: layouts
816 INTEGER, DIMENSION(2) :: distribution_layout
817 INTEGER, DIMENSION(3) :: no, np
818 INTEGER, DIMENSION(:), POINTER :: i_vals
819 LOGICAL :: debug, is_fullspace, odd, &
820 pw_grid_layout_all, spherical
821 REAL(kind=dp) :: em, et, flops, gsq, perf, t, t_max, &
822 t_min, tend, tstart
823 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: t_end, t_start
824 TYPE(cell_type), POINTER :: box
825 TYPE(pw_c1d_gs_type) :: ca, cc
826 TYPE(pw_c3d_rs_type) :: cb
827 TYPE(pw_grid_type), POINTER :: grid
828
829!..set fft lib
830
831 CALL init_fft(globenv%default_fft_library, alltoall=.false., fftsg_sizes=.true., &
832 pool_limit=globenv%fft_pool_scratch_limit, &
833 wisdom_file=globenv%fftw_wisdom_file_name, &
834 plan_style=globenv%fftw_plan_type)
835
836 !..the unit cell (should not really matter, the number of grid points do)
837 NULLIFY (box, grid)
838 CALL cell_create(box)
839 box%hmat = reshape([10.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 8.0_dp, 0.0_dp, &
840 0.0_dp, 0.0_dp, 7.0_dp], [3, 3])
841 CALL init_cell(box)
842
843 CALL section_vals_get(pw_transfer_section, n_repetition=n_rep)
844 DO i_rep = 1, n_rep
845
846 ! how often should we do the transfer
847 CALL section_vals_val_get(pw_transfer_section, "N_loop", i_rep_section=i_rep, i_val=n_loop)
848 ALLOCATE (t_start(n_loop))
849 ALLOCATE (t_end(n_loop))
850
851 ! setup of the grids
852 CALL section_vals_val_get(pw_transfer_section, "GRID", i_rep_section=i_rep, i_vals=i_vals)
853 np = i_vals
854
855 CALL section_vals_val_get(pw_transfer_section, "PW_GRID_BLOCKED", i_rep_section=i_rep, i_val=blocked_id)
856 CALL section_vals_val_get(pw_transfer_section, "DEBUG", i_rep_section=i_rep, l_val=debug)
857
858 CALL section_vals_val_get(pw_transfer_section, "PW_GRID_LAYOUT_ALL", i_rep_section=i_rep, &
859 l_val=pw_grid_layout_all)
860
861 ! prepare to loop over all or a specific layout
862 IF (pw_grid_layout_all) THEN
863 ! count layouts that fit
864 itmp = 0
865 ! start from 2, (/1,para_env%num_pe/) is not supported
866 DO p = 2, para_env%num_pe
867 q = para_env%num_pe/p
868 IF (p*q == para_env%num_pe) THEN
869 itmp = itmp + 1
870 END IF
871 END DO
872 ! build list
873 ALLOCATE (layouts(2, itmp))
874 itmp = 0
875 DO p = 2, para_env%num_pe
876 q = para_env%num_pe/p
877 IF (p*q == para_env%num_pe) THEN
878 itmp = itmp + 1
879 layouts(:, itmp) = [p, q]
880 END IF
881 END DO
882 ELSE
883 CALL section_vals_val_get(pw_transfer_section, "PW_GRID_LAYOUT", i_rep_section=i_rep, i_vals=i_vals)
884 ALLOCATE (layouts(2, 1))
885 layouts(:, 1) = i_vals
886 END IF
887
888 DO i_layout = 1, SIZE(layouts, 2)
889
890 distribution_layout = layouts(:, i_layout)
891
892 CALL section_vals_val_get(pw_transfer_section, "PW_GRID", i_rep_section=i_rep, i_val=itmp)
893
894 ! from cp_control_utils
895 SELECT CASE (itmp)
897 spherical = .true.
898 is_fullspace = .false.
900 spherical = .false.
901 is_fullspace = .true.
903 spherical = .false.
904 is_fullspace = .false.
905 END SELECT
906
907 ! from pw_env_methods
908 IF (spherical) THEN
909 grid_span = halfspace
910 spherical = .true.
911 odd = .true.
912 ELSE IF (is_fullspace) THEN
913 grid_span = fullspace
914 spherical = .false.
915 odd = .false.
916 ELSE
917 grid_span = halfspace
918 spherical = .false.
919 odd = .true.
920 END IF
921
922 ! actual setup
923 CALL pw_grid_create(grid, para_env, box%hmat, grid_span=grid_span, odd=odd, spherical=spherical, &
924 blocked=blocked_id, npts=np, fft_usage=.true., &
925 rs_dims=distribution_layout, iounit=iw)
926
927 IF (iw > 0) CALL m_flush(iw)
928
929 ! note that the number of grid points might be different from what the user requested (fft-able needed)
930 no = grid%npts
931
932 CALL ca%create(grid)
933 CALL cb%create(grid)
934 CALL cc%create(grid)
935
936 ! initialize data
937 CALL pw_zero(ca)
938 CALL pw_zero(cb)
939 CALL pw_zero(cc)
940 nn = SIZE(ca%array)
941 DO ig = 1, nn
942 gsq = grid%gsq(ig)
943 ca%array(ig) = exp(-gsq)
944 END DO
945
946 flops = product(no)*30.0_dp*log(real(maxval(no), kind=dp))
947 tstart = m_walltime()
948 DO ip = 1, n_loop
949 CALL para_env%sync()
950 t_start(ip) = m_walltime()
951 CALL pw_transfer(ca, cb, debug)
952 CALL pw_transfer(cb, cc, debug)
953 CALL para_env%sync()
954 t_end(ip) = m_walltime()
955 END DO
956 tend = m_walltime()
957 t = tend - tstart + threshold
958 IF (t > 0.0_dp) THEN
959 perf = real(n_loop, kind=dp)*2.0_dp*flops*1.e-6_dp/t
960 ELSE
961 perf = 0.0_dp
962 END IF
963
964 em = maxval(abs(ca%array(:) - cc%array(:)))
965 CALL para_env%max(em)
966 et = sum(abs(ca%array(:) - cc%array(:)))
967 CALL para_env%sum(et)
968 t_min = minval(t_end - t_start)
969 t_max = maxval(t_end - t_start)
970
971 IF (para_env%is_source()) THEN
972 WRITE (iw, *)
973 WRITE (iw, '(A,T67,E14.6)') " Parallel FFT Tests: Maximal Error ", em
974 WRITE (iw, '(A,T67,E14.6)') " Parallel FFT Tests: Total Error ", et
975 WRITE (iw, '(A,T67,F14.0)') &
976 " Parallel FFT Tests: Performance [Mflops] ", perf
977 WRITE (iw, '(A,T67,F14.6)') " Best time : ", t_min
978 WRITE (iw, '(A,T67,F14.6)') " Worst time: ", t_max
979 IF (iw > 0) CALL m_flush(iw)
980 END IF
981
982 ! need debugging ???
983 IF (em > toler .OR. et > toler) THEN
984 cpwarn("The FFT results are not accurate ... starting debug pw_transfer")
985 CALL pw_transfer(ca, cb, .true.)
986 CALL pw_transfer(cb, cc, .true.)
987 END IF
988
989 ! done with these grids
990 CALL ca%release()
991 CALL cb%release()
992 CALL cc%release()
993 CALL pw_grid_release(grid)
994
995 END DO
996
997 ! local arrays
998 DEALLOCATE (layouts)
999 DEALLOCATE (t_start)
1000 DEALLOCATE (t_end)
1001
1002 END DO
1003
1004 ! cleanup
1005 CALL cell_release(box)
1006 CALL finalize_fft(para_env, wisdom_file=globenv%fftw_wisdom_file_name)
1007
1008 END SUBROUTINE pw_fft_test
1009
1010! **************************************************************************************************
1011!> \brief Tests the eigensolver library routines
1012!> \param para_env ...
1013!> \param iw ...
1014!> \param eigensolver_section ...
1015!> \par History
1016!> JGH 6-Feb-2001 : Test and performance code
1017!> \author JGH 1-JAN-2001
1018! **************************************************************************************************
1019 SUBROUTINE eigensolver_test(para_env, iw, eigensolver_section)
1020
1021 TYPE(mp_para_env_type), POINTER :: para_env
1022 INTEGER :: iw
1023 TYPE(section_vals_type), POINTER :: eigensolver_section
1024
1025 INTEGER :: diag_method, i, i_loop, i_rep, &
1026 init_method, j, n, n_loop, n_rep, &
1027 neig, unit_number
1028 REAL(kind=dp) :: t1, t2
1029 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eigenvalues
1030 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: buffer
1031 TYPE(cp_blacs_env_type), POINTER :: blacs_env
1032 TYPE(cp_fm_struct_type), POINTER :: fmstruct
1033 TYPE(cp_fm_type) :: eigenvectors, matrix, work
1034 TYPE(rng_stream_type), ALLOCATABLE :: rng_stream
1035
1036 IF (iw > 0) THEN
1037 WRITE (unit=iw, fmt="(/,/,T2,A,/)") "EIGENSOLVER TEST"
1038 END IF
1039
1040 ! create blacs env corresponding to para_env
1041 NULLIFY (blacs_env)
1042 CALL cp_blacs_env_create(blacs_env=blacs_env, &
1043 para_env=para_env)
1044
1045 ! loop over all tests
1046 CALL section_vals_get(eigensolver_section, n_repetition=n_rep)
1047 DO i_rep = 1, n_rep
1048
1049 ! parse section
1050 CALL section_vals_val_get(eigensolver_section, "N", i_rep_section=i_rep, i_val=n)
1051 CALL section_vals_val_get(eigensolver_section, "EIGENVALUES", i_rep_section=i_rep, i_val=neig)
1052 CALL section_vals_val_get(eigensolver_section, "DIAG_METHOD", i_rep_section=i_rep, i_val=diag_method)
1053 CALL section_vals_val_get(eigensolver_section, "INIT_METHOD", i_rep_section=i_rep, i_val=init_method)
1054 CALL section_vals_val_get(eigensolver_section, "N_loop", i_rep_section=i_rep, i_val=n_loop)
1055
1056 ! proper number of eigs
1057 IF (neig < 0) neig = n
1058 neig = min(neig, n)
1059
1060 ! report
1061 IF (iw > 0) THEN
1062 WRITE (iw, *) "Matrix size", n
1063 WRITE (iw, *) "Number of eigenvalues", neig
1064 WRITE (iw, *) "Timing loops", n_loop
1065 SELECT CASE (diag_method)
1066 CASE (do_diag_syevd)
1067 WRITE (iw, *) "Diag using syevd"
1068 CASE (do_diag_syevx)
1069 WRITE (iw, *) "Diag using syevx"
1070 CASE DEFAULT
1071 ! stop
1072 END SELECT
1073
1074 SELECT CASE (init_method)
1075 CASE (do_mat_random)
1076 WRITE (iw, *) "using random matrix"
1077 CASE (do_mat_read)
1078 WRITE (iw, *) "reading from file"
1079 CASE DEFAULT
1080 ! stop
1081 END SELECT
1082 END IF
1083
1084 ! create matrix struct type
1085 NULLIFY (fmstruct)
1086 CALL cp_fm_struct_create(fmstruct=fmstruct, &
1087 para_env=para_env, &
1088 context=blacs_env, &
1089 nrow_global=n, &
1090 ncol_global=n)
1091
1092 ! create all needed matrices, and buffers for the eigenvalues
1093 CALL cp_fm_create(matrix=matrix, &
1094 matrix_struct=fmstruct, &
1095 name="MATRIX")
1096 CALL cp_fm_set_all(matrix, 0.0_dp)
1097
1098 CALL cp_fm_create(matrix=eigenvectors, &
1099 matrix_struct=fmstruct, &
1100 name="EIGENVECTORS")
1101 CALL cp_fm_set_all(eigenvectors, 0.0_dp)
1102
1103 CALL cp_fm_create(matrix=work, &
1104 matrix_struct=fmstruct, &
1105 name="WORK")
1106 CALL cp_fm_set_all(matrix, 0.0_dp)
1107
1108 ALLOCATE (eigenvalues(n))
1109 eigenvalues = 0.0_dp
1110 ALLOCATE (buffer(1, n))
1111
1112 ! generate initial matrix, either by reading a file, or using random numbers
1113 IF (para_env%is_source()) THEN
1114 SELECT CASE (init_method)
1115 CASE (do_mat_random)
1116 rng_stream = rng_stream_type( &
1117 name="rng_stream", &
1118 distribution_type=uniform, &
1119 extended_precision=.true.)
1120 CASE (do_mat_read)
1121 CALL open_file(file_name="MATRIX", &
1122 file_action="READ", &
1123 file_form="FORMATTED", &
1124 file_status="OLD", &
1125 unit_number=unit_number)
1126 END SELECT
1127 END IF
1128
1129 DO i = 1, n
1130 IF (para_env%is_source()) THEN
1131 SELECT CASE (init_method)
1132 CASE (do_mat_random)
1133 DO j = i, n
1134 buffer(1, j) = rng_stream%next() - 0.5_dp
1135 END DO
1136 !MK activate/modify for a diagonal dominant symmetric matrix:
1137 !MK buffer(1,i) = 10.0_dp*buffer(1,i)
1138 CASE (do_mat_read)
1139 READ (unit=unit_number, fmt=*) buffer(1, 1:n)
1140 END SELECT
1141 END IF
1142 CALL para_env%bcast(buffer)
1143 SELECT CASE (init_method)
1144 CASE (do_mat_random)
1145 CALL cp_fm_set_submatrix(fm=matrix, &
1146 new_values=buffer, &
1147 start_row=i, &
1148 start_col=i, &
1149 n_rows=1, &
1150 n_cols=n - i + 1, &
1151 alpha=1.0_dp, &
1152 beta=0.0_dp, &
1153 transpose=.false.)
1154 CALL cp_fm_set_submatrix(fm=matrix, &
1155 new_values=buffer, &
1156 start_row=i, &
1157 start_col=i, &
1158 n_rows=n - i + 1, &
1159 n_cols=1, &
1160 alpha=1.0_dp, &
1161 beta=0.0_dp, &
1162 transpose=.true.)
1163 CASE (do_mat_read)
1164 CALL cp_fm_set_submatrix(fm=matrix, &
1165 new_values=buffer, &
1166 start_row=i, &
1167 start_col=1, &
1168 n_rows=1, &
1169 n_cols=n, &
1170 alpha=1.0_dp, &
1171 beta=0.0_dp, &
1172 transpose=.false.)
1173 END SELECT
1174 END DO
1175
1176 DEALLOCATE (buffer)
1177
1178 IF (para_env%is_source()) THEN
1179 SELECT CASE (init_method)
1180 CASE (do_mat_read)
1181 CALL close_file(unit_number=unit_number)
1182 END SELECT
1183 END IF
1184
1185 DO i_loop = 1, n_loop
1186 eigenvalues = 0.0_dp
1187 CALL cp_fm_set_all(eigenvectors, 0.0_dp)
1188 CALL cp_fm_to_fm(source=matrix, &
1189 destination=work)
1190
1191 ! DONE, now testing
1192 t1 = m_walltime()
1193 SELECT CASE (diag_method)
1194 CASE (do_diag_syevd)
1195 CALL cp_fm_syevd(matrix=work, &
1196 eigenvectors=eigenvectors, &
1197 eigenvalues=eigenvalues)
1198 CASE (do_diag_syevx)
1199 CALL cp_fm_syevx(matrix=work, &
1200 eigenvectors=eigenvectors, &
1201 eigenvalues=eigenvalues, &
1202 neig=neig, &
1203 work_syevx=1.0_dp)
1204 END SELECT
1205 t2 = m_walltime()
1206 IF (iw > 0) WRITE (iw, *) "Timing for loop ", i_loop, " : ", t2 - t1
1207 END DO
1208
1209 IF (iw > 0) THEN
1210 WRITE (iw, *) "Eigenvalues: "
1211 WRITE (unit=iw, fmt="(T3,5F14.6)") eigenvalues(1:neig)
1212 WRITE (unit=iw, fmt="(T3,A4,F16.6)") "Sum:", sum(eigenvalues(1:neig))
1213 WRITE (iw, *) ""
1214 END IF
1215
1216 ! Clean up
1217 DEALLOCATE (eigenvalues)
1218 CALL cp_fm_release(matrix=work)
1219 CALL cp_fm_release(matrix=eigenvectors)
1220 CALL cp_fm_release(matrix=matrix)
1221 CALL cp_fm_struct_release(fmstruct=fmstruct)
1222
1223 END DO
1224
1225 CALL cp_blacs_env_release(blacs_env=blacs_env)
1226
1227 END SUBROUTINE eigensolver_test
1228
1229! **************************************************************************************************
1230!> \brief Tests the parallel matrix multiply
1231!> \param para_env ...
1232!> \param iw ...
1233!> \param cp_fm_gemm_test_section ...
1234! **************************************************************************************************
1235 SUBROUTINE cp_fm_gemm_test(para_env, iw, cp_fm_gemm_test_section)
1236
1237 TYPE(mp_para_env_type), POINTER :: para_env
1238 INTEGER :: iw
1239 TYPE(section_vals_type), POINTER :: cp_fm_gemm_test_section
1240
1241 CHARACTER(LEN=1) :: transa, transb
1242 INTEGER :: i_loop, i_rep, k, m, n, n_loop, n_rep, ncol_block, ncol_block_actual, &
1243 ncol_global, np, nrow_block, nrow_block_actual, nrow_global
1244 INTEGER, DIMENSION(:), POINTER :: grid_2d
1245 LOGICAL :: force_blocksize, row_major, transa_p, &
1246 transb_p
1247 REAL(kind=dp) :: t1, t2, t3, t4
1248 TYPE(cp_blacs_env_type), POINTER :: blacs_env
1249 TYPE(cp_fm_struct_type), POINTER :: fmstruct_a, fmstruct_b, fmstruct_c
1250 TYPE(cp_fm_type) :: matrix_a, matrix_b, matrix_c
1251
1252 CALL section_vals_get(cp_fm_gemm_test_section, n_repetition=n_rep)
1253 DO i_rep = 1, n_rep
1254
1255 ! how often should we do the multiply
1256 CALL section_vals_val_get(cp_fm_gemm_test_section, "N_loop", i_rep_section=i_rep, i_val=n_loop)
1257
1258 ! matrices def.
1259 CALL section_vals_val_get(cp_fm_gemm_test_section, "K", i_rep_section=i_rep, i_val=k)
1260 CALL section_vals_val_get(cp_fm_gemm_test_section, "N", i_rep_section=i_rep, i_val=n)
1261 CALL section_vals_val_get(cp_fm_gemm_test_section, "M", i_rep_section=i_rep, i_val=m)
1262 CALL section_vals_val_get(cp_fm_gemm_test_section, "transa", i_rep_section=i_rep, l_val=transa_p)
1263 CALL section_vals_val_get(cp_fm_gemm_test_section, "transb", i_rep_section=i_rep, l_val=transb_p)
1264 CALL section_vals_val_get(cp_fm_gemm_test_section, "nrow_block", i_rep_section=i_rep, i_val=nrow_block)
1265 CALL section_vals_val_get(cp_fm_gemm_test_section, "ncol_block", i_rep_section=i_rep, i_val=ncol_block)
1266 CALL section_vals_val_get(cp_fm_gemm_test_section, "ROW_MAJOR", i_rep_section=i_rep, l_val=row_major)
1267 CALL section_vals_val_get(cp_fm_gemm_test_section, "GRID_2D", i_rep_section=i_rep, i_vals=grid_2d)
1268 CALL section_vals_val_get(cp_fm_gemm_test_section, "FORCE_BLOCKSIZE", i_rep_section=i_rep, l_val=force_blocksize)
1269 transa = "N"
1270 transb = "N"
1271 IF (transa_p) transa = "T"
1272 IF (transb_p) transb = "T"
1273
1274 IF (iw > 0) THEN
1275 WRITE (iw, '(T2,A)') "----------- TESTING PARALLEL MATRIX MULTIPLY -------------"
1276 WRITE (iw, '(T2,A)', advance="NO") "C = "
1277 IF (transa_p) THEN
1278 WRITE (iw, '(A)', advance="NO") "TRANSPOSE(A) x"
1279 ELSE
1280 WRITE (iw, '(A)', advance="NO") "A x "
1281 END IF
1282 IF (transb_p) THEN
1283 WRITE (iw, '(A)') "TRANSPOSE(B) "
1284 ELSE
1285 WRITE (iw, '(A)') "B "
1286 END IF
1287 WRITE (iw, '(T2,A,T50,I5,A,I5)') 'requested block size', nrow_block, ' by ', ncol_block
1288 WRITE (iw, '(T2,A,T50,I5)') 'number of repetitions of cp_fm_gemm ', n_loop
1289 WRITE (iw, '(T2,A,T50,L5)') 'Row Major', row_major
1290 WRITE (iw, '(T2,A,T50,2I7)') 'GRID_2D ', grid_2d
1291 WRITE (iw, '(T2,A,T50,L5)') 'Force blocksize ', force_blocksize
1292 ! check the return value of pilaenv, too small values limit the performance (assuming pdgemm is the vanilla variant)
1293 np = cp_fm_pilaenv(0, 'D')
1294 IF (np > 0) THEN
1295 WRITE (iw, '(T2,A,T50,I5)') 'PILAENV blocksize', np
1296 END IF
1297 END IF
1298
1299 NULLIFY (blacs_env)
1300 CALL cp_blacs_env_create(blacs_env=blacs_env, &
1301 para_env=para_env, &
1302 row_major=row_major, &
1303 grid_2d=grid_2d)
1304
1305 NULLIFY (fmstruct_a)
1306 IF (transa_p) THEN
1307 nrow_global = m; ncol_global = k
1308 ELSE
1309 nrow_global = k; ncol_global = m
1310 END IF
1311 CALL cp_fm_struct_create(fmstruct=fmstruct_a, para_env=para_env, context=blacs_env, &
1312 nrow_global=nrow_global, ncol_global=ncol_global, &
1313 nrow_block=nrow_block, ncol_block=ncol_block, force_block=force_blocksize)
1314 CALL cp_fm_struct_get(fmstruct_a, nrow_block=nrow_block_actual, ncol_block=ncol_block_actual)
1315 IF (iw > 0) WRITE (iw, '(T2,A,I9,A,I9,A,I5,A,I5)') 'matrix A ', nrow_global, " by ", ncol_global, &
1316 ' using blocks of ', nrow_block_actual, ' by ', ncol_block_actual
1317
1318 IF (transb_p) THEN
1319 nrow_global = n; ncol_global = m
1320 ELSE
1321 nrow_global = m; ncol_global = n
1322 END IF
1323 NULLIFY (fmstruct_b)
1324 CALL cp_fm_struct_create(fmstruct=fmstruct_b, para_env=para_env, context=blacs_env, &
1325 nrow_global=nrow_global, ncol_global=ncol_global, &
1326 nrow_block=nrow_block, ncol_block=ncol_block, force_block=force_blocksize)
1327 CALL cp_fm_struct_get(fmstruct_b, nrow_block=nrow_block_actual, ncol_block=ncol_block_actual)
1328 IF (iw > 0) WRITE (iw, '(T2,A,I9,A,I9,A,I5,A,I5)') 'matrix B ', nrow_global, " by ", ncol_global, &
1329 ' using blocks of ', nrow_block_actual, ' by ', ncol_block_actual
1330
1331 NULLIFY (fmstruct_c)
1332 nrow_global = k
1333 ncol_global = n
1334 CALL cp_fm_struct_create(fmstruct=fmstruct_c, para_env=para_env, context=blacs_env, &
1335 nrow_global=nrow_global, ncol_global=ncol_global, &
1336 nrow_block=nrow_block, ncol_block=ncol_block, force_block=force_blocksize)
1337 CALL cp_fm_struct_get(fmstruct_c, nrow_block=nrow_block_actual, ncol_block=ncol_block_actual)
1338 IF (iw > 0) WRITE (iw, '(T2,A,I9,A,I9,A,I5,A,I5)') 'matrix C ', nrow_global, " by ", ncol_global, &
1339 ' using blocks of ', nrow_block_actual, ' by ', ncol_block_actual
1340
1341 CALL cp_fm_create(matrix=matrix_a, matrix_struct=fmstruct_a, name="MATRIX A")
1342 CALL cp_fm_create(matrix=matrix_b, matrix_struct=fmstruct_b, name="MATRIX B")
1343 CALL cp_fm_create(matrix=matrix_c, matrix_struct=fmstruct_c, name="MATRIX C")
1344
1345 CALL random_number(matrix_a%local_data)
1346 CALL random_number(matrix_b%local_data)
1347 CALL random_number(matrix_c%local_data)
1348
1349 IF (iw > 0) CALL m_flush(iw)
1350
1351 t1 = m_walltime()
1352 DO i_loop = 1, n_loop
1353 t3 = m_walltime()
1354 CALL parallel_gemm(transa, transb, k, n, m, 1.0_dp, matrix_a, matrix_b, 0.0_dp, matrix_c)
1355 t4 = m_walltime()
1356 IF (iw > 0) THEN
1357 WRITE (iw, '(T2,A,T50,F12.6)') "cp_fm_gemm timing: ", (t4 - t3)
1358 CALL m_flush(iw)
1359 END IF
1360 END DO
1361 t2 = m_walltime()
1362
1363 IF (iw > 0) THEN
1364 WRITE (iw, '(T2,A,T50,F12.6)') "average cp_fm_gemm timing: ", (t2 - t1)/n_loop
1365 IF (t2 > t1) THEN
1366 WRITE (iw, '(T2,A,T50,F12.6)') "cp_fm_gemm Gflops per MPI task: ", &
1367 2*real(m, kind=dp)*real(n, kind=dp)*real(k, kind=dp)*n_loop/max(0.001_dp, t2 - t1)/1.0e9_dp/para_env%num_pe
1368 END IF
1369 END IF
1370
1371 CALL cp_fm_release(matrix=matrix_a)
1372 CALL cp_fm_release(matrix=matrix_b)
1373 CALL cp_fm_release(matrix=matrix_c)
1374 CALL cp_fm_struct_release(fmstruct=fmstruct_a)
1375 CALL cp_fm_struct_release(fmstruct=fmstruct_b)
1376 CALL cp_fm_struct_release(fmstruct=fmstruct_c)
1377 CALL cp_blacs_env_release(blacs_env=blacs_env)
1378
1379 END DO
1380
1381 END SUBROUTINE cp_fm_gemm_test
1382
1383! **************************************************************************************************
1384!> \brief Tests the DBCSR interface.
1385!> \param para_env ...
1386!> \param iw ...
1387!> \param input_section ...
1388! **************************************************************************************************
1389 SUBROUTINE cp_dbcsr_tests(para_env, iw, input_section)
1390
1391 TYPE(mp_para_env_type), POINTER :: para_env
1392 INTEGER :: iw
1393 TYPE(section_vals_type), POINTER :: input_section
1394
1395 CHARACTER, DIMENSION(3) :: types
1396 INTEGER :: data_type, i_rep, k, m, n, n_loop, &
1397 n_rep, test_type
1398 INTEGER, DIMENSION(:), POINTER :: bs_k, bs_m, bs_n, nproc
1399 LOGICAL :: always_checksum, retain_sparsity, &
1400 transa_p, transb_p
1401 REAL(kind=dp) :: alpha, beta, filter_eps, s_a, s_b, s_c
1402
1403! ---------------------------------------------------------------------------
1404
1405 NULLIFY (bs_m, bs_n, bs_k)
1406 CALL section_vals_get(input_section, n_repetition=n_rep)
1407 CALL dbcsr_reset_randmat_seed()
1408 DO i_rep = 1, n_rep
1409 ! how often should we do the multiply
1410 CALL section_vals_val_get(input_section, "N_loop", i_rep_section=i_rep, i_val=n_loop)
1411
1412 ! matrices def.
1413 CALL section_vals_val_get(input_section, "TEST_TYPE", i_rep_section=i_rep, i_val=test_type)
1414 CALL section_vals_val_get(input_section, "DATA_TYPE", i_rep_section=i_rep, i_val=data_type)
1415 CALL section_vals_val_get(input_section, "K", i_rep_section=i_rep, i_val=k)
1416 CALL section_vals_val_get(input_section, "N", i_rep_section=i_rep, i_val=n)
1417 CALL section_vals_val_get(input_section, "M", i_rep_section=i_rep, i_val=m)
1418 CALL section_vals_val_get(input_section, "transa", i_rep_section=i_rep, l_val=transa_p)
1419 CALL section_vals_val_get(input_section, "transb", i_rep_section=i_rep, l_val=transb_p)
1420 CALL section_vals_val_get(input_section, "bs_m", i_rep_section=i_rep, &
1421 i_vals=bs_m)
1422 CALL section_vals_val_get(input_section, "bs_n", i_rep_section=i_rep, &
1423 i_vals=bs_n)
1424 CALL section_vals_val_get(input_section, "bs_k", i_rep_section=i_rep, &
1425 i_vals=bs_k)
1426 CALL section_vals_val_get(input_section, "keepsparse", i_rep_section=i_rep, l_val=retain_sparsity)
1427 CALL section_vals_val_get(input_section, "asparsity", i_rep_section=i_rep, r_val=s_a)
1428 CALL section_vals_val_get(input_section, "bsparsity", i_rep_section=i_rep, r_val=s_b)
1429 CALL section_vals_val_get(input_section, "csparsity", i_rep_section=i_rep, r_val=s_c)
1430 CALL section_vals_val_get(input_section, "alpha", i_rep_section=i_rep, r_val=alpha)
1431 CALL section_vals_val_get(input_section, "beta", i_rep_section=i_rep, r_val=beta)
1432 CALL section_vals_val_get(input_section, "nproc", i_rep_section=i_rep, &
1433 i_vals=nproc)
1434 CALL section_vals_val_get(input_section, "atype", i_rep_section=i_rep, &
1435 c_val=types(1))
1436 CALL section_vals_val_get(input_section, "btype", i_rep_section=i_rep, &
1437 c_val=types(2))
1438 CALL section_vals_val_get(input_section, "ctype", i_rep_section=i_rep, &
1439 c_val=types(3))
1440 CALL section_vals_val_get(input_section, "filter_eps", &
1441 i_rep_section=i_rep, r_val=filter_eps)
1442 CALL section_vals_val_get(input_section, "ALWAYS_CHECKSUM", i_rep_section=i_rep, l_val=always_checksum)
1443
1444 CALL dbcsr_run_tests(para_env%get_handle(), iw, nproc, &
1445 [m, n, k], &
1446 [transa_p, transb_p], &
1447 bs_m, bs_n, bs_k, &
1448 [s_a, s_b, s_c], &
1449 alpha, beta, &
1450 data_type=data_type, &
1451 test_type=test_type, &
1452 n_loops=n_loop, eps=filter_eps, retain_sparsity=retain_sparsity, &
1453 always_checksum=always_checksum)
1454 END DO
1455 END SUBROUTINE cp_dbcsr_tests
1456
1457! **************************************************************************************************
1458!> \brief Tests the DBM library.
1459!> \param para_env ...
1460!> \param iw ...
1461!> \param input_section ...
1462! **************************************************************************************************
1463 SUBROUTINE run_dbm_tests(para_env, iw, input_section)
1464
1465 TYPE(mp_para_env_type), POINTER :: para_env
1466 INTEGER :: iw
1467 TYPE(section_vals_type), POINTER :: input_section
1468
1469 INTEGER :: i_rep, k, m, n, n_loop, n_rep
1470 INTEGER, DIMENSION(:), POINTER :: bs_k, bs_m, bs_n
1471 LOGICAL :: always_checksum, retain_sparsity, &
1472 transa_p, transb_p
1473 REAL(kind=dp) :: alpha, beta, filter_eps, s_a, s_b, s_c
1474
1475! ---------------------------------------------------------------------------
1476
1477 NULLIFY (bs_m, bs_n, bs_k)
1478 CALL section_vals_get(input_section, n_repetition=n_rep)
1479 CALL dbcsr_reset_randmat_seed()
1480 DO i_rep = 1, n_rep
1481 CALL section_vals_val_get(input_section, "N_loop", i_rep_section=i_rep, i_val=n_loop)
1482 CALL section_vals_val_get(input_section, "K", i_rep_section=i_rep, i_val=k)
1483 CALL section_vals_val_get(input_section, "N", i_rep_section=i_rep, i_val=n)
1484 CALL section_vals_val_get(input_section, "M", i_rep_section=i_rep, i_val=m)
1485 CALL section_vals_val_get(input_section, "transa", i_rep_section=i_rep, l_val=transa_p)
1486 CALL section_vals_val_get(input_section, "transb", i_rep_section=i_rep, l_val=transb_p)
1487 CALL section_vals_val_get(input_section, "bs_m", i_rep_section=i_rep, i_vals=bs_m)
1488 CALL section_vals_val_get(input_section, "bs_n", i_rep_section=i_rep, i_vals=bs_n)
1489 CALL section_vals_val_get(input_section, "bs_k", i_rep_section=i_rep, i_vals=bs_k)
1490 CALL section_vals_val_get(input_section, "keepsparse", i_rep_section=i_rep, l_val=retain_sparsity)
1491 CALL section_vals_val_get(input_section, "asparsity", i_rep_section=i_rep, r_val=s_a)
1492 CALL section_vals_val_get(input_section, "bsparsity", i_rep_section=i_rep, r_val=s_b)
1493 CALL section_vals_val_get(input_section, "csparsity", i_rep_section=i_rep, r_val=s_c)
1494 CALL section_vals_val_get(input_section, "alpha", i_rep_section=i_rep, r_val=alpha)
1495 CALL section_vals_val_get(input_section, "beta", i_rep_section=i_rep, r_val=beta)
1496 CALL section_vals_val_get(input_section, "filter_eps", i_rep_section=i_rep, r_val=filter_eps)
1497 CALL section_vals_val_get(input_section, "ALWAYS_CHECKSUM", i_rep_section=i_rep, l_val=always_checksum)
1498
1499 CALL dbm_run_tests(mp_group=para_env, &
1500 io_unit=iw, &
1501 matrix_sizes=[m, n, k], &
1502 trs=[transa_p, transb_p], &
1503 bs_m=bs_m, &
1504 bs_n=bs_n, &
1505 bs_k=bs_k, &
1506 sparsities=[s_a, s_b, s_c], &
1507 alpha=alpha, &
1508 beta=beta, &
1509 n_loops=n_loop, &
1510 eps=filter_eps, &
1511 retain_sparsity=retain_sparsity, &
1512 always_checksum=always_checksum)
1513 END DO
1514 END SUBROUTINE run_dbm_tests
1515
1516END MODULE library_tests
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Test of Electron Repulsion Routines (ERI)
real(kind=dp), parameter threshold
subroutine, public eri_test(iw)
...
Handles all functions related to the CELL.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:608
Test of Clebsch-Gordon Coefficients.
Definition cg_test.F:14
subroutine, public clebsch_gordon_test()
...
Definition cg_test.F:42
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
subroutine, public cp_eri_mme_perf_acc_test(para_env, iw, eri_mme_test_section)
...
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:311
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:122
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_gemm(transa, transb, m, n, k, alpha, matrix_a, matrix_b, beta, matrix_c, a_first_col, a_first_row, b_first_col, b_first_row, c_first_col, c_first_row)
computes matrix_c = beta * matrix_c + alpha * ( matrix_a ** transa ) * ( matrix_b ** transb )
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
subroutine, public cp_fm_syevd(matrix, eigenvectors, eigenvalues, info)
Computes all eigenvalues and vectors of a real symmetric matrix significantly faster than syevx,...
Definition cp_fm_diag.F:573
subroutine, public cp_fm_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
Definition cp_fm_diag.F:797
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_get(fmstruct, para_env, context, descriptor, ncol_block, nrow_block, nrow_global, ncol_global, first_p_pos, row_indices, col_indices, nrow_local, ncol_local, nrow_locals, ncol_locals, local_leading_dimension)
returns the values of various attributes of the matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
integer function, public cp_fm_pilaenv(ictxt, prec)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
subroutine, public init_input_type(input_settings, nsmax, rs_grid_section, ilevel, higher_grid_layout)
parses an input section to assign the proper values to the input type
subroutine, public dbm_run_tests(mp_group, io_unit, matrix_sizes, trs, bs_m, bs_n, bs_k, sparsities, alpha, beta, n_loops, eps, retain_sparsity, always_checksum)
Tests the DBM library.
Definition dbm_tests.F:54
subroutine, public fft_radix_operations(radix_in, radix_out, operation)
Determine the allowed lengths of FFT's '''.
Definition fft_tools.F:239
integer, parameter, public bwfft
Definition fft_tools.F:146
integer, parameter, public fft_radix_closest
Definition fft_tools.F:147
subroutine, public init_fft(fftlib, alltoall, fftsg_sizes, pool_limit, wisdom_file, plan_style)
...
Definition fft_tools.F:186
integer, parameter, public fwfft
Definition fft_tools.F:146
subroutine, public finalize_fft(para_env, wisdom_file)
does whatever is needed to finalize the current fft setup
Definition fft_tools.F:216
Define type storing the global information of a run. Keep the amount of stored data small....
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_diag_syevd
integer, parameter, public do_mat_read
integer, parameter, public do_pwgrid_ns_fullspace
integer, parameter, public do_diag_syevx
integer, parameter, public do_pwgrid_spherical
integer, parameter, public do_mat_random
integer, parameter, public do_pwgrid_ns_halfspace
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Performance tests for basic tasks like matrix multiplies, copy, fft.
subroutine, public lib_test(root_section, para_env, globenv)
Master routine for tests.
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:124
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition machine.F:141
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public gaussi
Interface to the message passing library MPI.
Routines to calculate the minimax coefficients in order to approximate 1/x as a sum over exponential ...
Definition minimax_exp.F:29
subroutine, public validate_exp_minimax(n_r, iw)
Unit test checking that numerical error of minimax approximations generated using any k15 or k53 coef...
Routines to calculate frequency and time grids (integration points and weights) for correlation metho...
Definition mp2_grids.F:14
subroutine, public test_least_square_ft(nr, iw)
test the singular value decomposition for the computation of integration weights for the Fourier tran...
Definition mp2_grids.F:1149
Interface to the message passing library MPI.
subroutine, public mpi_perf_test(comm, npow, output_unit)
Tests the MPI library.
basic linear algebra operations for full matrixes
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
subroutine advance(self, e, c)
Advance the state by n steps, i.e. jump n steps forward, if n > 0, or backward if n < 0.
integer, parameter, public uniform
integer, parameter, public halfspace
integer, parameter, public fullspace
This module defines the grid data type and some basic operations on it.
Definition pw_grids.F:36
subroutine, public pw_grid_release(pw_grid)
releases the given pw grid
Definition pw_grids.F:2163
subroutine, public rs_grid_print(rs, iounit)
Print information on grids to output.
subroutine, public rs_grid_create(rs, desc)
...
subroutine, public rs_grid_create_descriptor(desc, pw_grid, input_settings, border_points)
Determine the setup of real space grids - this is divided up into the creation of a descriptor and th...
subroutine, public transfer_pw2rs(rs, pw)
...
subroutine, public rs_grid_release_descriptor(rs_desc)
releases the given rs grid descriptor (see doc/ReferenceCounting.html)
subroutine, public transfer_rs2pw(rs, pw)
...
subroutine, public rs_grid_release(rs_grid)
releases the given rs grid (see doc/ReferenceCounting.html)
subroutine, public rs_grid_zero(rs)
Initialize grid to zero.
Calculates 2-center integrals for different r12 operators comparing the Solid harmonic Gaussian integ...
subroutine, public shg_integrals_perf_acc_test(iw, shg_integrals_test_section)
Unit test for performance and accuracy of the SHG integrals.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment