From 5469ba87eae25bc6294e2795facbcb0e8379b584 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 23 Nov 2017 11:16:38 +0100 Subject: [PATCH] Forgot file --- plugins/MPI/broadcast.irp.f | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 plugins/MPI/broadcast.irp.f diff --git a/plugins/MPI/broadcast.irp.f b/plugins/MPI/broadcast.irp.f new file mode 100644 index 00000000..11c5698a --- /dev/null +++ b/plugins/MPI/broadcast.irp.f @@ -0,0 +1,81 @@ +subroutine mpi_bcast_psi(energy, size_energy) + implicit none + BEGIN_DOC +! Broadcast the wave function via MPI + END_DOC + integer, intent(in) :: size_energy + double precision, intent(inout) :: energy(size_energy) + integer :: sze + PROVIDE mpi_initialized + + IRP_IF MPI + include 'mpif.h' + integer :: ierr + + call MPI_BCAST (N_states, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast N_states' + stop -1 + endif + + call MPI_BCAST (N_det, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast N_det' + stop -1 + endif + + call MPI_BCAST (psi_det_size, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast psi_det_size' + stop -1 + endif + + if (.not.mpi_master) then + TOUCH psi_det_size N_det N_states + endif + + print *, size(psi_det), psi_det_size + call MPI_BCAST (psi_det, size(psi_det), MPI_BIT_KIND, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast psi_det' + stop -1 + endif + + call MPI_BCAST (psi_coef, size(psi_coef), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast psi_coef' + stop -1 + endif + + if (.not.mpi_master) then + TOUCH psi_det psi_coef + endif + + call MPI_BCAST (N_det_generators, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast N_det_generators' + stop -1 + endif + + if (.not.mpi_master) then + TOUCH N_det_generators + endif + + call MPI_BCAST (N_det_selectors, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast N_det_selectors' + stop -1 + endif + + if (.not.mpi_master) then + TOUCH N_det_selectors + endif + + call MPI_BCAST (energy, size(energy), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= 0) then + print *, 'Unable to broadcast energy' + stop -1 + endif + + IRP_ENDIF +end