Email from Mike Toews on 7/25/17:
"Hi Eric and Vivek,
I've been looking to improve the speed of MT3D-USGS, and I've attached a patch of suggested changes, which seem to compile fine with GNU, PGI and Intel compilers. Here are some notes:
Changes to adv1.f: these are preliminary, and I'm not sure if they have any improvement. I was focusing on tidying up the variable declarations as I've found that the function CFACE and subroutine SADV1U have a high number of calls when using the TVD scheme, and are a focus of future improvement.
Changes to gcg1.f: there are several improvements. The most effective was to move LU and LL to mt_module.f90 as an integer parameter, as these do not change, and don't need to continuously be set. Other changes are to reverse the order of DO loops to work with Fortran's row-major array ordering. For instance, around Line 783. I've changed L to be a fixed array with 19 items, as it does not need to be a dynamic array with allocation/deallocation. Other changes are to use modern variable declarations for MVPRD, MTVPRD, QSOLVE and MIC, which generally help them read better. These subroutines also have a high number of calls while running any type of model.
I may look at other improvements in the near future, and will pass these along. Please review and take any changes you feel are improvements. Also, if you need the patch in a different format, or whatever, let me know."
mt_optim1.txt
Applied Mike's suggested changes as documented in the difference (*.diff extension changed to .txt) file attached to the previous post. Changes reflected in commit c4f03bd
Email from Mike Toews on 7/25/17: "Hi Eric and Vivek,
I've been looking to improve the speed of MT3D-USGS, and I've attached a patch of suggested changes, which seem to compile fine with GNU, PGI and Intel compilers. Here are some notes:
Changes to adv1.f: these are preliminary, and I'm not sure if they have any improvement. I was focusing on tidying up the variable declarations as I've found that the function CFACE and subroutine SADV1U have a high number of calls when using the TVD scheme, and are a focus of future improvement.
Changes to gcg1.f: there are several improvements. The most effective was to move LU and LL to mt_module.f90 as an integer parameter, as these do not change, and don't need to continuously be set. Other changes are to reverse the order of DO loops to work with Fortran's row-major array ordering. For instance, around Line 783. I've changed L to be a fixed array with 19 items, as it does not need to be a dynamic array with allocation/deallocation. Other changes are to use modern variable declarations for MVPRD, MTVPRD, QSOLVE and MIC, which generally help them read better. These subroutines also have a high number of calls while running any type of model. I may look at other improvements in the near future, and will pass these along. Please review and take any changes you feel are improvements. Also, if you need the patch in a different format, or whatever, let me know." mt_optim1.txt