41#include "../base/base_uses.f90" 
   46   CHARACTER(len=*), 
PARAMETER, 
PRIVATE :: moduleN = 
'swarm' 
   61   SUBROUTINE run_swarm(input_declaration, root_section, para_env, globenv, input_path)
 
   66      CHARACTER(LEN=*), 
INTENT(IN)                       :: input_path
 
   68      CHARACTER(len=*), 
PARAMETER                        :: routinen = 
'run_swarm' 
   70      INTEGER                                            :: handle, iw, n_workers
 
   73      CALL timeset(routinen, handle)
 
   77                                "SWARM%PRINT%MASTER_RUN_INFO", extension=
".masterLog")
 
   79      IF (iw > 0) 
WRITE (iw, 
"(A)") 
" SWARM| Ready to roll :-)" 
   84      IF (n_workers == 1 .AND. para_env%num_pe == 1) 
THEN 
   85         IF (iw > 0) 
WRITE (iw, 
"(A)") 
" SWARM| Running in single worker mode." 
   86         CALL swarm_serial_driver(input_declaration, root_section, input_path, para_env, globenv)
 
   88         IF (iw > 0) 
WRITE (iw, 
"(A)") 
" SWARM| Running in master / workers mode." 
   90         CALL swarm_parallel_driver(n_workers, input_declaration, root_section, input_path, para_env, globenv, iw)
 
 
  105   SUBROUTINE swarm_serial_driver(input_declaration, root_section, input_path, para_env, globenv)
 
  108      CHARACTER(LEN=*), 
INTENT(IN)                       :: input_path
 
  113      LOGICAL                                            :: should_stop
 
  120                             input_path, worker_id=1)
 
  125      should_stop = .false.
 
  126      DO WHILE (.NOT. should_stop)
 
  127         CALL timeset(
"swarm_worker_await_reply", handle)
 
  129         CALL timestop(handle)
 
  139   END SUBROUTINE swarm_serial_driver
 
  152   SUBROUTINE swarm_parallel_driver(n_workers, input_declaration, root_section, input_path, para_env, globenv, iw)
 
  153      INTEGER, 
INTENT(IN)                                :: n_workers
 
  156      CHARACTER(LEN=*), 
INTENT(IN)                       :: input_path
 
  159      INTEGER, 
INTENT(IN)                                :: iw
 
  167         CALL swarm_parallel_worker_driver(
swarm_mpi, input_declaration, worker_id, root_section, input_path)
 
  169         CALL swarm_parallel_master_driver(
swarm_mpi, n_workers, root_section, globenv)
 
  174   END SUBROUTINE swarm_parallel_driver
 
  185   SUBROUTINE swarm_parallel_worker_driver(swarm_mpi, input_declaration, worker_id, root_section, input_path)
 
  188      INTEGER, 
INTENT(IN)                                :: worker_id
 
  190      CHARACTER(LEN=*), 
INTENT(IN)                       :: input_path
 
  193      LOGICAL                                            :: should_stop
 
  198                             root_section, input_path, worker_id=worker_id)
 
  203      should_stop = .false.
 
  204      DO WHILE (.NOT. should_stop)
 
  205         CALL timeset(
"swarm_worker_await_reply", handle)
 
  209         CALL timestop(handle)
 
  217   END SUBROUTINE swarm_parallel_worker_driver
 
  227   SUBROUTINE swarm_parallel_master_driver(swarm_mpi, n_workers, root_section, globenv)
 
  229      INTEGER, 
INTENT(IN)                                :: n_workers
 
  233      CHARACTER(len=default_string_length)               :: command
 
  234      INTEGER                                            :: i_shutdowns, j, wid
 
  235      LOGICAL, 
DIMENSION(n_workers)                      :: is_waiting
 
  239      is_waiting(:) = .false.
 
  246      DO WHILE (i_shutdowns < n_workers)
 
  250         j = mod(j + 1, n_workers + 1)
 
  253         ELSE IF (is_waiting(j)) 
THEN 
  254            is_waiting(j) = .false.
 
  265         IF (trim(command) == 
"wait") 
THEN 
  267            is_waiting(wid) = .true.
 
  270            IF (trim(command) == 
"shutdown") i_shutdowns = i_shutdowns + 1
 
  277   END SUBROUTINE swarm_parallel_master_driver
 
Adds an entry from a swarm-message.
 
Returns an entry from a swarm-message.
 
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)
...
 
Define type storing the global information of a run. Keep the amount of stored data small....
 
Defines the basic variable types.
 
integer, parameter, public default_string_length
 
Interface to the message passing library MPI.
 
Master's routines for the swarm-framework.
 
subroutine, public swarm_master_finalize(master)
Finalizes the swarm master.
 
subroutine, public swarm_master_steer(master, report, cmd)
Central steering routine of the swarm master.
 
subroutine, public swarm_master_init(master, para_env, globenv, root_section, n_workers)
Initializes the swarm master.
 
Swarm-message, a convenient data-container for with build-in serialization.
 
subroutine, public swarm_message_free(msg)
Deallocates all entries contained in a swarm-message.
 
Handles the MPI communication of the swarm framework.
 
subroutine, public swarm_mpi_init(swarm_mpi, world_para_env, root_section, n_workers, worker_id, iw)
Initialize MPI communicators for a swarm run.
 
subroutine, public swarm_mpi_send_command(swarm_mpi, cmd)
Sends a command via MPI.
 
subroutine, public swarm_mpi_recv_report(swarm_mpi, report)
Receives a report via MPI.
 
subroutine, public swarm_mpi_recv_command(swarm_mpi, cmd)
Receives a command via MPI and broadcasts it within a worker.
 
subroutine, public swarm_mpi_send_report(swarm_mpi, report)
Sends a report via MPI.
 
subroutine, public swarm_mpi_finalize(swarm_mpi, root_section)
Finalizes the MPI communicators of a swarm run.
 
Workers's routines for the swarm-framework.
 
subroutine, public swarm_worker_finalize(worker)
Finalizes a swarm worker.
 
subroutine, public swarm_worker_execute(worker, cmd, report, should_stop)
Central execute routine of the swarm worker.
 
subroutine, public swarm_worker_init(worker, para_env, input_declaration, root_section, input_path, worker_id)
Initializes a swarm worker.
 
Swarm-framwork, provides a convenient master/worker architecture.
 
subroutine, public run_swarm(input_declaration, root_section, para_env, globenv, input_path)
Central driver routine of the swarm framework, called by cp2k_runs.F.
 
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