Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get PFUnit working on melvin. #1844

Merged
merged 3 commits into from
Aug 30, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/acme/machines/config_compilers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ for mct, etc.
<CONFIG_ARGS> --host=Linux </CONFIG_ARGS>
<NETCDF_PATH>$(NETCDFROOT)</NETCDF_PATH>
<PNETCDF_PATH>$(PNETCDFROOT)</PNETCDF_PATH>
<PFUNIT_PATH MPILIB="mpi-serial" compile_threaded="false">/sems-data-store/ACME/pfunit/pfunit-3.2.8</PFUNIT_PATH>
<ADD_SLIBS> $(shell $(NETCDF_PATH)/bin/nf-config --flibs) -lblas -llapack</ADD_SLIBS>
<CXX_LIBS>-lstdc++ -lmpi_cxx</CXX_LIBS>
<ALBANY_PATH>/projects/install/rhel6-x86_64/ACME/AlbanyTrilinos/Albany/build/install</ALBANY_PATH>
Expand Down
7 changes: 5 additions & 2 deletions config/acme/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,19 @@
<command name="load">sems-env</command>
<command name="load">sems-git</command>
<command name="load">sems-python/2.7.9</command>
<command name="load">sems-cmake/2.8.12</command>
</modules>
<modules compiler="gnu">
<command name="load">sems-gcc/5.3.0</command>
</modules>
<modules compiler="intel">
<command name="load">sems-intel/16.0.3</command>
</modules>
<modules>
<modules mpilib="mpi-serial">
<command name="load">sems-netcdf/4.4.1/exo</command>
</modules>
<modules mpilib="!mpi-serial">
<command name="load">sems-openmpi/1.8.7</command>
<command name="load">sems-cmake/2.8.12</command>
<command name="load">sems-netcdf/4.4.1/exo_parallel</command>
</modules>
</module_system>
Expand Down
11 changes: 5 additions & 6 deletions scripts/fortran_unit_testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def parse_command_line(args):
args.use_openmp, args.xml_test_list, args.verbose


def cmake_stage(name, test_spec_dir, build_optimized, use_mpiserial, mpirun_command, output,
def cmake_stage(name, test_spec_dir, build_optimized, use_mpiserial, mpirun_command, output, pfunit_path,
cmake_args=None, clean=False, verbose=False, enable_genf90=True, color=True):
"""Run cmake in the current working directory.

Expand Down Expand Up @@ -182,6 +182,7 @@ def cmake_stage(name, test_spec_dir, build_optimized, use_mpiserial, mpirun_comm
"-DCIME_CMAKE_MODULE_DIRECTORY="+os.path.abspath(os.path.join(_CIMEROOT,"src","CMake")),
"-DCMAKE_BUILD_TYPE="+build_type,
"-DPFUNIT_MPIRUN='"+mpirun_command+"'",
"-DPFUNIT_PATH="+pfunit_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you understand why this is needed? I'm curious because it isn't needed on any of the 4 machines I've tested on. I don't remember for sure, but I thought that CMake typically picked up PFUNIT_PATH from the environment.

That said, it seems like this doesn't do any harm, so I'm okay with its being here if it truly seems to be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@billsacks I didn't have PFUNIT_PATH set in my environment. I tried setting it and that didn't help.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what's going on in my unit test builds: The Macros.cmake file that is written in the unit test build directory has lines like this:

  if("$ENV{MPILIB}" STREQUAL "mpich")
    if("$ENV{compile_threaded}" STREQUAL "true")
      set(PFUNIT_PATH "/usr/local/pfunit/pfunit-mpi")
    endif()
  endif()
  if("$ENV{MPILIB}" STREQUAL "mpi-serial")
    if("$ENV{compile_threaded}" STREQUAL "false")
      set(PFUNIT_PATH "/usr/local/pfunit/pfunit3.2.8-serial")
    endif()
  endif()

Do you not get something like that in your Macros.cmake file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@billsacks no, mine looks nothing like that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I know the issue - the configure generation of Macros.cmake requires the config_compilers.xml version that cesm but not acme is using - you need to update your config_compilers.xml file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgfouca Did you ever determine if this setting of -DPFUNIT_PATH (and most of the other changes you made in run_tests.py) was still needed after you got the Macros.cmake file set up appropriately? My hunch is that this should not be needed, since PFUNIT_PATH should now come from Macros.cmake

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The V1 macros file doesn't set PFUNIT_PATH, so yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for clarifying

]
if use_mpiserial:
cmake_command.append("-DUSE_MPI_SERIAL=ON")
Expand Down Expand Up @@ -241,6 +242,7 @@ def find_pfunit(compilerobj, mpilib, use_openmp):
"""PFUNIT_PATH not found for this machine and compiler, with MPILIB={} and compile_threaded={}.
You must specify PFUNIT_PATH in config_compilers.xml, with attributes MPILIB and compile_threaded.""".format(mpilib, attrs['compile_threaded']))
logger.info("Using PFUNIT_PATH: {}".format(pfunit_path.text))
return pfunit_path.text

#=================================================
# Iterate over input suite specs, building the tests.
Expand Down Expand Up @@ -306,7 +308,7 @@ def _main():

compilerobj = Compilers(machobj, compiler=compiler, mpilib=mpilib)

find_pfunit(compilerobj, mpilib=mpilib, use_openmp=use_openmp)
pfunit_path = find_pfunit(compilerobj, mpilib=mpilib, use_openmp=use_openmp)

debug = not build_optimized
os_ = machobj.get_value("OS")
Expand Down Expand Up @@ -375,7 +377,7 @@ def _main():
if not os.path.islink("Macros.cmake"):
os.symlink(os.path.join(build_dir,"Macros.cmake"), "Macros.cmake")
use_mpiserial = not use_mpi
cmake_stage(name, directory, build_optimized, use_mpiserial, mpirun_command, output, verbose=verbose,
cmake_stage(name, directory, build_optimized, use_mpiserial, mpirun_command, output, pfunit_path, verbose=verbose,
enable_genf90=enable_genf90, cmake_args=cmake_args)
make_stage(name, output, make_j, clean=clean, verbose=verbose)

Expand All @@ -399,8 +401,5 @@ def _main():
run_cmd_no_fail(" ".join(ctest_command), from_dir=label, arg_stdout=None, arg_stderr=subprocess.STDOUT)





if __name__ == "__main__":
_main()
2 changes: 1 addition & 1 deletion scripts/lib/CIME/BuildTools/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def _copy_depends_files(machine_name, machines_dir, output_dir, compiler):
if os.path.isfile(dfile) and not os.path.isfile(outputdfile):
shutil.copyfile(dfile, outputdfile)


def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug,
sysos, unit_testing):
"""
Expand All @@ -79,6 +78,7 @@ def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug,
ems_file = EnvMachSpecific(output_dir, unit_testing=unit_testing)
ems_file.populate(machobj)
ems_file.write()
ems_file.load_env(compiler, debug, mpilib)
for shell in ('sh', 'csh'):
ems_file.make_env_mach_specific_file(compiler, debug, mpilib, shell)
shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
Expand Down
2 changes: 1 addition & 1 deletion src/CMake/Compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endfunction()
#=================================================

# Detect "STOP" for CTest.
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL NAG)
if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL NAG)
# NAG prints the stop code instead of yielding a non-zero return, so we
# have to use a regex to catch that.
function(define_Fortran_stop_failure test_name)
Expand Down