-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is now only one executable being built: either cable-mpi or cable, depending if MPI support is available or not. When MPI support is available, the code will now automatically run the serial driver if using only one MPI process, instead of stopping with an error like before.
- Loading branch information
1 parent
17ed25c
commit b2e57a7
Showing
5 changed files
with
108 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
!============================================================================== | ||
! This source code is part of the | ||
! Australian Community Atmosphere Biosphere Land Exchange (CABLE) model. | ||
! This work is licensed under the CSIRO Open Source Software License | ||
! Agreement (variation of the BSD / MIT License). | ||
! | ||
! You may not use this file except in compliance with this License. | ||
! A copy of the License (CSIRO_BSD_MIT_License_v2.0_CABLE.txt) is located | ||
! in each directory containing CABLE code. | ||
! | ||
! ============================================================================== | ||
! Purpose: Stub for the master driver when MPI is not available. | ||
! | ||
! ============================================================================== | ||
! | ||
MODULE cable_mpimaster | ||
IMPLICIT NONE | ||
|
||
PRIVATE | ||
PUBLIC :: mpidrv_master | ||
|
||
CONTAINS | ||
|
||
SUBROUTINE mpidrv_master(comm) | ||
INTEGER, INTENT(IN) :: comm | ||
|
||
! This should never be called! | ||
STOP | ||
|
||
END SUBROUTINE mpidrv_master | ||
|
||
END MODULE cable_mpimaster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
!============================================================================== | ||
! This source code is part of the | ||
! Australian Community Atmosphere Biosphere Land Exchange (CABLE) model. | ||
! This work is licensed under the CSIRO Open Source Software License | ||
! Agreement (variation of the BSD / MIT License). | ||
! | ||
! You may not use this file except in compliance with this License. | ||
! A copy of the License (CSIRO_BSD_MIT_License_v2.0_CABLE.txt) is located | ||
! in each directory containing CABLE code. | ||
! | ||
! ============================================================================== | ||
! Purpose: Stub for the worker driver when MPI is not available. | ||
! | ||
! ============================================================================== | ||
! | ||
MODULE cable_mpiworker | ||
IMPLICIT NONE | ||
|
||
PRIVATE | ||
PUBLIC :: mpidrv_worker | ||
|
||
CONTAINS | ||
|
||
SUBROUTINE mpidrv_worker(comm) | ||
INTEGER, INTENT(IN) :: comm | ||
|
||
! This should never be called! | ||
STOP | ||
|
||
END SUBROUTINE mpidrv_worker | ||
|
||
END MODULE cable_mpiworker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,10 @@ | |
! A copy of the License (CSIRO_BSD_MIT_License_v2.0_CABLE.txt) is located | ||
! in each directory containing CABLE code. | ||
! | ||
! ============================================================================== | ||
! Purpose: Bare bones MPI driver for CABLE | ||
! | ||
! Contact: [email protected] | ||
! | ||
! History: MPI wrapper developed by Maciej Golebiewski (2012) | ||
! | ||
! ============================================================================== | ||
! | ||
PROGRAM mpi_driver | ||
USE mpi | ||
USE cable_mpi_mod, ONLY : mpi_grp_t, mpi_mod_init, mpi_mod_end, mpi_check_error | ||
PROGRAM cable_offline_driver | ||
USE cable_mpi_mod, ONLY : mpi_grp_t, mpi_mod_init, mpi_mod_end | ||
USE cable_driver_init_mod | ||
|
||
USE cable_serial | ||
USE cable_mpimaster | ||
USE cable_mpiworker | ||
|
||
|
@@ -35,20 +25,19 @@ PROGRAM mpi_driver | |
|
||
CALL cable_driver_init(mpi_grp) | ||
|
||
IF (mpi_grp%size < 2) THEN | ||
WRITE(*,*) 'This program needs at least 2 processes to run!' | ||
CALL mpi_grp%abort() | ||
END IF | ||
|
||
IF (mpi_grp%rank == 0) THEN | ||
CALL mpidrv_master (mpi_grp%comm) | ||
IF (mpi_grp%size == 1) THEN | ||
CALL serialdrv() | ||
ELSE | ||
CALL mpidrv_worker (mpi_grp%comm) | ||
IF (mpi_grp%rank == 0) THEN | ||
CALL mpidrv_master(mpi_grp%comm) | ||
ELSE | ||
CALL mpidrv_worker(mpi_grp%comm) | ||
END IF | ||
END IF | ||
|
||
CALL mpi_mod_end() | ||
|
||
CALL CPU_TIME(etime) | ||
PRINT *, 'Finished. ', etime, ' seconds needed for ' | ||
|
||
END PROGRAM mpi_driver | ||
END PROGRAM cable_offline_driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters