Function depending on the global variable inside module

Thank you!
Yes, I was thinking it must be something related with shared memory stuff that can cause issue for global variable. For MPI, it seems using global variable is safe because each core are independent.