diff --git a/src/core/dbcsr_config.F b/src/core/dbcsr_config.F index dd377fe059d..43e1852d725 100644 --- a/src/core/dbcsr_config.F +++ b/src/core/dbcsr_config.F @@ -73,10 +73,20 @@ MODULE dbcsr_config LOGICAL, PARAMETER :: has_MPI = .FALSE. #endif + INTEGER, PARAMETER :: mm_stack_default_size_cpu = 1000 + INTEGER, PARAMETER :: mm_stack_default_size_gpu = 30000 #if defined(__HAS_smm_vec) || defined (__DBCSR_ACC) - INTEGER, PARAMETER :: mm_stack_default_size = 30000 + INTEGER, PARAMETER :: mm_stack_default_size = mm_stack_default_size_gpu #else - INTEGER, PARAMETER :: mm_stack_default_size = 1000 + INTEGER, PARAMETER :: mm_stack_default_size = mm_stack_default_size_cpu +#endif + + LOGICAL, PARAMETER :: mm_dense_default_cpu = .TRUE. + LOGICAL, PARAMETER :: mm_dense_default_gpu = .FALSE. +#if defined (__DBCSR_ACC) + LOGICAL, PARAMETER :: mm_dense_default = mm_dense_default_gpu +#else + LOGICAL, PARAMETER :: mm_dense_default = mm_dense_default_cpu #endif #if defined(__LIBXSMM) @@ -151,9 +161,9 @@ MODULE dbcsr_config SET_PARAMETER_DEFAULT(NUM_LAYERS_3D, CONF_PAR_INT, 1) SET_PARAMETER_DEFAULT(USE_COMM_THREAD, CONF_PAR_LOGICAL, .TRUE.) SET_PARAMETER_DEFAULT(COMM_THREAD_LOAD, CONF_PAR_INT, 100) - SET_PARAMETER_DEFAULT(MM_DENSE, CONF_PAR_LOGICAL,.NOT. has_acc) + SET_PARAMETER_DEFAULT(MM_DENSE, CONF_PAR_LOGICAL, mm_dense_default) SET_PARAMETER_DEFAULT(MULTREC_LIMIT, CONF_PAR_INT, 512) - SET_PARAMETER_DEFAULT(TURN_OFF_ACC, CONF_PAR_LOGICAL, .FALSE.) + SET_PARAMETER_DEFAULT(RUN_ON_GPU, CONF_PAR_LOGICAL, .TRUE.) SET_PARAMETER_DEFAULT(ACCDRV_THREAD_BUFFERS, CONF_PAR_INT, 8) TYPE(CONF_PAR_LOGICAL) :: ACCDRV_AVOID_AFTER_BUSY = & CONF_PAR_LOGICAL(name="ACCDRV_AVOID_AFTER_BUSY", val=.FALSE., defval=.FALSE.) @@ -342,7 +352,7 @@ SUBROUTINE dbcsr_set_config( & comm_thread_load, & mm_dense, & multrec_limit, & - turn_off_acc, & + run_on_gpu, & accdrv_thread_buffers, & accdrv_avoid_after_busy, & accdrv_min_flop_process, & @@ -371,7 +381,7 @@ SUBROUTINE dbcsr_set_config( & LOGICAL, INTENT(IN), OPTIONAL :: use_comm_thread INTEGER, INTENT(IN), OPTIONAL :: comm_thread_load LOGICAL, INTENT(IN), OPTIONAL :: mm_dense - LOGICAL, INTENT(IN), OPTIONAL :: turn_off_acc + LOGICAL, INTENT(IN), OPTIONAL :: run_on_gpu INTEGER, INTENT(IN), OPTIONAL :: multrec_limit, accdrv_thread_buffers LOGICAL, INTENT(IN), OPTIONAL :: accdrv_avoid_after_busy INTEGER, INTENT(IN), OPTIONAL :: accdrv_min_flop_process @@ -393,7 +403,7 @@ SUBROUTINE dbcsr_set_config( & CALL dbcsr_cfg%num_layers_3D%set(num_layers_3D) CALL dbcsr_cfg%use_comm_thread%set(use_comm_thread) CALL dbcsr_cfg%multrec_limit%set(multrec_limit) - CALL dbcsr_cfg%turn_off_acc%set(turn_off_acc) + CALL dbcsr_cfg%run_on_gpu%set(run_on_gpu) CALL dbcsr_cfg%accdrv_thread_buffers%set(accdrv_thread_buffers) CALL dbcsr_cfg%accdrv_avoid_after_busy%set(accdrv_avoid_after_busy) CALL dbcsr_cfg%accdrv_min_flop_process%set(accdrv_min_flop_process) @@ -426,14 +436,14 @@ SUBROUTINE dbcsr_set_config( & CALL dbcsr_cfg%mm_driver%set(mm_driver) ! If ACC is turned-off, use the CPU defaults - IF (.NOT. PRESENT(mm_stack_size) .AND. dbcsr_cfg%turn_off_acc%val) THEN - CALL dbcsr_cfg%mm_stack_size%set(1000) + IF (.NOT. PRESENT(mm_stack_size) .AND. .NOT. dbcsr_cfg%run_on_gpu%val) THEN + CALL dbcsr_cfg%mm_stack_size%set(mm_stack_default_size_cpu) ELSE CALL dbcsr_cfg%mm_stack_size%set(mm_stack_size) END IF - IF (.NOT. PRESENT(mm_stack_size) .AND. dbcsr_cfg%turn_off_acc%val) THEN - CALL dbcsr_cfg%mm_dense%set(.TRUE.) + IF (.NOT. PRESENT(mm_dense) .AND. .NOT. dbcsr_cfg%run_on_gpu%val) THEN + CALL dbcsr_cfg%mm_dense%set(mm_dense_default_cpu) ELSE CALL dbcsr_cfg%mm_dense%set(mm_dense) END IF @@ -452,7 +462,7 @@ SUBROUTINE dbcsr_get_default_config( & use_comm_thread, & comm_thread_load, & mm_dense, & - turn_off_acc, & + run_on_gpu, & multrec_limit, & accdrv_thread_buffers, & accdrv_avoid_after_busy, & @@ -473,7 +483,7 @@ SUBROUTINE dbcsr_get_default_config( & INTEGER, INTENT(OUT), OPTIONAL :: num_layers_3D LOGICAL, INTENT(OUT), OPTIONAL :: use_comm_thread INTEGER, INTENT(OUT), OPTIONAL :: comm_thread_load - LOGICAL, INTENT(OUT), OPTIONAL :: mm_dense, turn_off_acc + LOGICAL, INTENT(OUT), OPTIONAL :: mm_dense, run_on_gpu INTEGER, INTENT(OUT), OPTIONAL :: multrec_limit, accdrv_thread_buffers LOGICAL, INTENT(OUT), OPTIONAL :: accdrv_avoid_after_busy INTEGER, INTENT(OUT), OPTIONAL :: accdrv_min_flop_process @@ -496,7 +506,7 @@ SUBROUTINE dbcsr_get_default_config( & IF (PRESENT(comm_thread_load)) comm_thread_load = dbcsr_cfg%comm_thread_load%defval IF (PRESENT(mm_dense)) mm_dense = dbcsr_cfg%mm_dense%defval IF (PRESENT(multrec_limit)) multrec_limit = dbcsr_cfg%multrec_limit%defval - IF (PRESENT(turn_off_acc)) turn_off_acc = dbcsr_cfg%turn_off_acc%defval + IF (PRESENT(run_on_gpu)) run_on_gpu = dbcsr_cfg%run_on_gpu%defval IF (PRESENT(accdrv_thread_buffers)) accdrv_thread_buffers = dbcsr_cfg%accdrv_thread_buffers%defval IF (PRESENT(accdrv_avoid_after_busy)) accdrv_avoid_after_busy = dbcsr_cfg%accdrv_avoid_after_busy%defval IF (PRESENT(accdrv_min_flop_process)) accdrv_min_flop_process = dbcsr_cfg%accdrv_min_flop_process%defval @@ -626,12 +636,7 @@ SUBROUTINE dbcsr_print_config(unit_nr) END IF END BLOCK - IF (dbcsr_cfg%turn_off_acc%val) THEN - WRITE (UNIT=unit_nr, FMT='(1X,A,T81,A4)') & - "DBCSR| ACC is turned off: only CPU is used", dbcsr_cfg%turn_off_acc%print_source() - END IF - - IF (use_acc()) THEN + IF (has_acc) THEN WRITE (UNIT=unit_nr, FMT='(1X,A,T70,I11)') & "DBCSR| ACC: Number of devices/node", dbcsr_acc_get_ndevices() WRITE (UNIT=unit_nr, FMT='(1X,A,T70,I11,A4)') & @@ -662,6 +667,8 @@ SUBROUTINE dbcsr_print_config(unit_nr) "DBCSR| ACC: Size of binning bins", dbcsr_cfg%accdrv_binning_binsize%val, & dbcsr_cfg%accdrv_binning_binsize%print_source() END IF + WRITE (UNIT=unit_nr, FMT='(1X,A,T80,L1,A4)') & + "DBCSR| ACC: GPU backend is enabled", dbcsr_cfg%run_on_gpu%val, dbcsr_cfg%run_on_gpu%print_source() END IF WRITE (UNIT=unit_nr, FMT='(1X,A,T74,ES7.1,A4)') & @@ -698,7 +705,7 @@ END SUBROUTINE reset_accdrv_active_device_id FUNCTION use_acc() LOGICAL :: use_acc - IF (has_acc .AND. .NOT. dbcsr_cfg%turn_off_acc%val) THEN + IF (has_acc .AND. dbcsr_cfg%run_on_gpu%val) THEN use_acc = .TRUE. ELSE use_acc = .FALSE.