make use of platform::putenv()

This commit is contained in:
Axel Kohlmeyer
2021-10-04 22:39:24 -04:00
parent 40f683c1a7
commit ee594a879b
3 changed files with 7 additions and 19 deletions

View File

@ -134,15 +134,16 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
init_pkg_lists();
#if defined(LMP_PYTHON) && defined(_WIN32)
// if the LAMMPSHOME environment variable is set, it should point
// If the LAMMPSHOME environment variable is set, it should point
// to the location of the LAMMPS installation tree where we bundle
// the matching Python installation for use with the PYTHON package.
// this is currently only used on Windows with the windows installer packages
// This is currently only used on Windows with the Windows installer packages
const char *lmpenv = getenv("LAMMPSHOME");
if (lmpenv) {
_putenv(utils::strdup(fmt::format("PYTHONHOME={}",lmpenv)));
platform::putenv(fmt::format("PYTHONHOME={}",lmpenv));
}
#endif
// check if -mpicolor is first arg
// if so, then 2 apps were launched with one mpirun command
// this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS