HamishGBrown / MuSTEM

Open source version of the MuSTEM multislice electron microscopy simulation code, developed at the University of Melbourne.
http://tcmp.ph.unimelb.edu.au/mustem/muSTEM.html
GNU General Public License v3.0
54 stars 26 forks source link

Memory allocation with PGI #17

Open bryandesser opened 5 years ago

bryandesser commented 5 years ago

I have found that certain newer versions of PGI throw memory allocation issues during the Pre-calculation setup stage when they encounter if(.not. ) statements that are not followed by then and a newline + endif. There are only a handful of these lines across the 4 simulation types (s_absorptive_tem.f90, s_absorptive_stem.f90, s_qep_tem.f90, s_qep_stem.f90). Seems to be a simple fix, for example:

Original: (118, s_absorptive_tem.f90) if(.not.load_grates) projected_potential = make_absorptive_grates(nopiy,nopix,n_slices)

Fixed:

if(.not.load_grates) then 
projected_potential = make_absorptive_grates(nopiy,nopix,n_slices)
endif

I have seen this issue on PGI 18 and 19 community editions, on two HPC clusters (Ohio Supercomputer Center and M3 Massive) as well as a local workstation running Ubuntu. All were compiled with CUDA 9 or 10.

HamishGBrown commented 5 years ago

Thanks Bryan, I'll update the source code and also see if I can reproduce the error in a simple program to send to PGI

HamishGBrown commented 5 years ago

Made the suggested fixes to muSTEM but I can't reproduce it in a simple program. I've tried every combination of global variables (which is what nopiy and nopix are), functions that return arrays (which is what make_absorptive_grates) and all different data types, so the actual problem with the PGI compiler might lie deeper.