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

Netcdf and related Find TPL modules refactoring to improve default find #156

Merged
merged 3 commits into from
Feb 24, 2017

Conversation

gsjaardema
Copy link
Contributor

Changes to TPL configuration modules proposed in trilinos/Trilinos#787

@bartlettroscoe
Copy link
Member

@gsjaardema, that for putting this PR together. Did you get a chance to test this against your SEACAS repo? Also, is there a PR for just the changes to Trilinos (i.e. part of trilinos/Trilinos#787)? Is it just the Trilinos/TPLsList.cmake file that needs to be updated as per this version?

I will get to this next week after I complete trilinos/Trilinos#482. This will be a test that backward compatibility when overriding vars is maintained.

@gsjaardema
Copy link
Contributor Author

gsjaardema commented Nov 28, 2016 via email

@bartlettroscoe
Copy link
Member

You are correct that the only Trilinos change is the TPLsList.cmake.

@gsjaardema, can you please do a quick PR on the github.com/trilinos/Trilinos site for the updated Trilinos/TPLsList.cmake file and reference this issue TriBITSPub/TriBITS#156? Otherwise, can I assume that it is basically this version with the paths for FindTPLCGNS.cmake, FindTPLHDF5.cmake and FindTPLNetcdf.cmake changed to point into "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/"?

I will get to test this soon and provide comments. However, just looking over this I am seeing that some small modifications will be needed in order to address the issues described at:

I can take care of those modifications and testing.

But to make sure that things are still working, can you provide some Trilinos configure options on specific SNL machines to make sure that those configure options still work?

@bartlettroscoe
Copy link
Member

@gsjaardema, also, can you please allow me to make new commits to your PR branch? See:

That will all me to make some modifications without having to swap out branches. This is a fairly new GitHub feature I think.

@gsjaardema
Copy link
Contributor Author

@bartlettroscoe It looks like you can make commits to my PR branch. The "Allow edits from maintainers" is enabled on this PR.

@gsjaardema
Copy link
Contributor Author

This is the script I use on my Mac for building SEACAS (and some other packages enabled)
It works with the PR.

cmake-script.txt

@bartlettroscoe bartlettroscoe changed the title Tpl refactor Netcdf and related Find TPL modules improvements Dec 15, 2016
@bartlettroscoe bartlettroscoe changed the title Netcdf and related Find TPL modules improvements Tpl refactor Dec 15, 2016
@bartlettroscoe bartlettroscoe changed the title Tpl refactor Netcdf and related Find TPL modules refactoring to improve default find Dec 15, 2016
@jrood-nrel
Copy link

I am a bit anxious to know when this might be committed. Any guesses? I only ask because it's quite relevant to my current project and if it is far enough away, I may try to implement a more portable PnetCDF link for my project in the meantime. Otherwise, I would be very grateful to have this find capability.

@bartlettroscoe
Copy link
Member

I am a bit anxious to know when this might be committed. Any guesses?

Hopefully not too long. I can try to move this closer to the top of my personal todo list. There are some modifications that will be needed along the lines of:

and then a good bit of manual testing to make sure that existing use cases still work. One of the last attempts to improve a find module ended up having to be backed out because of a break in backward compatibility (see #89).

@gsjaardema
Copy link
Contributor Author

gsjaardema commented Jan 13, 2017 via email

@bartlettroscoe
Copy link
Member

If all goes well, I should be able to start working on this next Wednesday. I have some high priority tasks (coming directly from higher up) for an important ECP-related Sandia project (the name of which we are not allowed to even mention here) that I have to attend before that. This at the top of the "Ready" column for TriBITS.

If there are two libraries (e.g. CGNS and NetCDF) that both have a dependency
on the same library (e.g. HDF5), then the previous code would only add
the hdf5 dependencies to whichever of the two libraries were processed
first.

The current behavior fixes this by adding the dependency to both
libraries, but still only adds the target for the dependent library
once.
@bartlettroscoe
Copy link
Member

I pulled the branches and tested with the standard CI build for Trilinos, and unless you have netcdf in your PATH, it can't find Netcdf where before it did it does not for these updated version. The old version of the FindTPLNetcdf.cmake module works without needing to augment PATH.

Therefore, I will now augment these updated FindTPL<TPL_NAME>.cmake modules to work both with the standard TriBITS TPL vars (e.g. Netcdf_INCLUDE_DIRS, Netcdf_LIBRARY_DIRS and Netcdf_LIBRARIES) but still use the default find that is enabled in these new find modules. This can be done as described in:

I will update the FindTPL<TPL_NAME>.cmake modules according and test.


DETAILED NOTES:

Also see:

The Trilinos branch is:

It contains the single commit:

which updates just the Trilinos/TPLsList.cmake file.

Then there is the TriBITS branch:

Together, these two branches should give the desired update to Trilinos TPLs for CGNS, Pnetcdf, and Netcdf.

I will test this with the standard SEMS-based Trilinos CI build. These updated files should work with that build with no changes. That should show some backward compatibility.

I created the local Trilinos branch:

[rabartl@crf450 Trilinos (develop)]$ git checkout -b netcdf-cgns-hdf5-1082 github/gsjaardema-patch-1 
Branch netcdf-cgns-hdf5-1082 set up to track remote branch gsjaardema-patch-1 from github.
Switched to a new branch 'netcdf-cgns-hdf5-1082'

I then created the TriBITS branch:

[rabartl@crf450 TriBITS (master)]$ git remote add gsjaardema  [email protected]:gsjaardema/TriBITS.git
[rabartl@crf450 TriBITS (master)]$ git fetch gsjaardema 
[rabartl@crf450 TriBITS (master)]$ git checkout -b netcdf-cgns-hdf5-156 gsjaardema/tpl-refactor 
Branch netcdf-cgns-hdf5-156 set up to track remote branch tpl-refactor from gsjaardema.
Switched to a new branch 'netcdf-cgns-hdf5-156'

Using the do-configure script:

#!/bin/bash

cmake \
-DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
-DTPL_ENABLE_MPI=ON \
-DCMAKE_BUILD_TYPE=RELEASE \
-DTrilinos_ENABLE_DEBUG=ON \
-DBUILD_SHARED_LIBS=ON \
-DTrilinos_ENABLE_SECONDARY_TESTED_CODE=OFF \
-DTrilinos_CONFIGURE_OPTIONS_FILE:STRING=cmake/std/MpiReleaseDebugSharedPtSettings.cmake,cmake/std/BasicCiTestingSettings.cmake \
-DTrilinos_ENABLE_DEBUG_SYMBOLS=ON \
-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION=ON \
-DTrilinos_ENABLE_CONFIGURE_TIMING=ON \
-DTrilinos_ENABLE_TESTS=ON \
-DTrilinos_TRACE_ADD_TEST=ON \
-DCTEST_BUILD_FLAGS=-j16 \
-DCTEST_PARALLEL_LEVEL=16 \
"$@" \
../../../Trilinos

Now I can test by bulding SEACAS under Trilinos using SEMS env:

$ cd ~/Trilinos.base/BUILDS/GCC-4.8.4/MPI_RELEASE_DEBUG_SHARED_PT
$ . ~/Trilinos.base/Trilinos/cmake/load_sems_dev_env.sh
$ rm -r CMake*
$ time ./do-configure \
    -DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
    -DTrilinos_ENABLE_SEACAS=ON \
    &> configure.out 

real    0m20.010s
user    0m5.909s
sys     0m2.475s

That passed the configure but it showed the warning:

-- NetCDF include file /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include/netcdf.h will be searched for define values
CMake Warning at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:184 (message):
  WARNING: The NetCDF found in does not have the correct NC_MAX_DIMS and
  NC_MAX_VARS.  It may not be compatible with Exodus.  See NetCDF-Mapping.md
  for details

Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:46 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- NetCDF does not require HDF5
-- NetCDF does not require PNetCDF
-- Found NetCDF: /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so  
-- NetCDF Version: 
-- 	NetCDF_NEEDS_HDF5        = 
-- 	NetCDF_NEEDS_PNetCDF     = 
-- 	NetCDF_PARALLEL          = False
-- 	NetCDF_INCLUDE_DIRS      = /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include
-- 	NetCDF_LIBRARIES         = /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so
-- 	NetCDF_BINARIES          = ncdump;ncgen;nccopy
-- TPL_Netcdf_LIBRARIES='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so'
-- TPL_Netcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'

That is a good warning about NC_MAX_DIMS and NC_MAX_VARS, but it seems a bit specific to Exodus and SEACAS. I wonder if this type of check and warning might be better to go into the SEACAS package configure itself since it is specific to SEACAS. Netcdf can be used by other packages than SEACAS that may not care if those vars are set.

Note that since it has "WARNING:", this will also result in a CDash warning being displayed on the CDash dashboard. Therefore, this should likely be changed from "WARNING:" to "NOTE:".

I am not sure how the libnetcdf.so file gets found. There is no indication how this gets found. Looking in the env, I see:

$ env | grep -i netcdf
MANPATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/man:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/man:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/man:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/man:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/man:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/share/man:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/man:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/share/man:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/man:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/share/man:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/man:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/share/man:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/share/man:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/man:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/share/man:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/man:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/share/man:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/man:/usr/share/man
SEMS_NETCDF_LIBRARY_PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib
SEMS_NETCDF_INCLUDE_PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include
LD_LIBRARY_PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/lib64:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/lib:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/lib:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/lib:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/lib64:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/lib:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/lib64:
PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/sbin:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/bin:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/sbin:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/bin:/ascldap/users/rabartl/install/cmake-trilinos-exp-next-9add695/bin:/home/vera_env/common_tools/cmake-3.6.2/bin:/home/vera_env/common_tools/git-2.6.4/bin:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/bin:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/bin:/home/vera_env/common_tools/autoconf-2.69/bin:/home/vera_env/common_tools/cmake-3.3.2/bin:/home/vera_env/common_tools:/home/vera_env/common_tools/cmake-3.6.2/bin:/home/vera_env/common_tools/git-2.6.4/bin:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/bin:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/bin:/home/vera_env/common_tools/autoconf-2.69/bin:/home/vera_env/common_tools/cmake-3.3.2/bin:/home/vera_env/common_tools:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/ascldap/users/rabartl/bin:/ascldap/users/rabartl/bin
_LMFILES_=/projects/sems/modulefiles/projects/sems-env:/projects/sems/modulefiles/rhel6-x86_64/sems/compiler/sems-python/2.7.9:/projects/sems/modulefiles/rhel6-x86_64/sems/utility/sems-cmake/3.5.2:/projects/sems/modulefiles/rhel6-x86_64/sems/utility/sems-git/2.10.1:/projects/sems/modulefiles/rhel6-x86_64/sems/compiler/sems-gcc/4.8.4:/projects/sems/modulefiles/rhel6-x86_64/sems/compiler/sems-openmpi/1.8.7:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-boost/1.55.0/base:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-zlib/1.2.8/base:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-hdf5/1.8.12/parallel:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-netcdf/4.3.2/parallel:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-parmetis/4.0.3/parallel:/projects/sems/modulefiles/rhel6-x86_64/sems/tpl/sems-superlu/4.3/base
SEMS_NETCDF_ROOT=/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel
LOADEDMODULES=sems-env:sems-python/2.7.9:sems-cmake/3.5.2:sems-git/2.10.1:sems-gcc/4.8.4:sems-openmpi/1.8.7:sems-boost/1.55.0/base:sems-zlib/1.2.8/base:sems-hdf5/1.8.12/parallel:sems-netcdf/4.3.2/parallel:sems-parmetis/4.0.3/parallel:sems-superlu/4.3/base
PYTHONPATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/lib/python2.6/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/lib/python2.6/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/lib/python2.7/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.7.2/openmpi/1.6.5/lib/python2.6/site-packages:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.6.5/lib/python2.6/site-packages
SEMS_LIBRARY_DATA=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/<COMPILER_NAME>/<COMPILER_VERSION>/base,SUPERLU:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/<COMPILER_NAME>/<COMPILER_VERSION>/<MPI_NAME>/<MPI_VERSION>/parallel,PARMETIS:/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/<COMPILER_NAME>/<COMPILER_VERSION>/<MPI_NAME>/<MPI_VERSION>/parallel,NETCDF:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/<COMPILER_NAME>/<COMPILER_VERSION>/<MPI_NAME>/<MPI_VERSION>/parallel,HDF5:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/<COMPILER_NAME>/<COMPILER_VERSION>/base,ZLIB:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/<COMPILER_NAME>/<COMPILER_VERSION>/base,BOOST:/projects/sems/install/rhel6-x86_64/sems/compiler/<COMPILER_NAME>/<COMPILER_VERSION>/openmpi/1.8.7,OPENMPI

Is FindNetcdf.cmake finding this from LD_LIBRARY_PATH or PATH? Is it finding it from SEMS_CDF_LIBRARY_PATH? I don't like magic. What if I remove the netcdf paths from PATH and LD_LIBRARY_PATH? Will it still find it? Let's try:

$ export LD_LIBRARY_PATH=LD_LIBRARY_PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/lib64:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/lib:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/lib:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/lib:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/lib:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/lib:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/lib64:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/lib:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/lib64:

$ export PATH=/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/superlu/4.3/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/parmetis/4.0.3/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/openmpi/1.8.7/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.4.7/LOCAL_VERSION_NOT_AVAILABLE/LOCAL_VERSION_NOT_AVAILABLE/parallel/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/tpl/boost/1.55.0/gcc/4.4.7/base/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/openmpi/1.8.7/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.4.7/openmpi/1.8.7/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/gcc/4.8.4/base/bin:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/sbin:/projects/sems/install/rhel6-x86_64/sems/utility/git/2.10.1/bin:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/sbin:/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/bin:/projects/sems/install/rhel6-x86_64/sems/compiler/python/2.7.9/bin:/ascldap/users/rabartl/install/cmake-trilinos-exp-next-9add695/bin:/home/vera_env/common_tools/cmake-3.6.2/bin:/home/vera_env/common_tools/git-2.6.4/bin:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/bin:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/bin:/home/vera_env/common_tools/autoconf-2.69/bin:/home/vera_env/common_tools/cmake-3.3.2/bin:/home/vera_env/common_tools:/home/vera_env/common_tools/cmake-3.6.2/bin:/home/vera_env/common_tools/git-2.6.4/bin:/home/vera_env/gcc-4.8.3/toolset/mpich-3.1.3/bin:/home/vera_env/gcc-4.8.3/toolset/gcc-4.8.3/bin:/home/vera_env/common_tools/autoconf-2.69/bin:/home/vera_env/common_tools/cmake-3.3.2/bin:/home/vera_env/common_tools:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/ascldap/users/rabartl/bin:/ascldap/users/rabartl/bin

Now configure again:

$ time ./do-configure \
    -DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
    -DTrilinos_ENABLE_SEACAS=ON \
    &> configure.out

real    0m5.978s
user    0m3.543s
sys     0m1.926s

That time it failed to configure with:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
CMake Error at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:163 (message):
  Can not locate NetCDF include directory
Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:46 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


CMake Error at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:274 (message):
  Can not locate NetCDF C library
Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:46 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- NetCDF does not require HDF5
-- NetCDF does not require PNetCDF
-- Can not locate NetCDF bin directory
CMake Error at /ascldap/users/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find NetCDF (missing: NetCDF_LIBRARIES NetCDF_INCLUDE_DIRS)
Call Stack (most recent call first):
  /ascldap/users/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:430 (find_package_handle_standard_args)
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:46 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- Configuring incomplete, errors occurred!

So it seems that FindNetCDF.cmake is looking in PATH. This breaks backward compatibility because before you could specify Netcdf_INCLUDE_DIRS, Netcdf_LIBRARY_DIRS and Netcdf_LIBRARIES and it would find the Netcdf libraries. That is why the FindTPLNetcdf.cmake module must be written according to:

I went back to the original definition of the FindTPLNetcdf.cmake module and it finds Netcdf just fine:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
-- Searching for libs in Netcdf_LIBRARY_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib;/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib'
-- Searching for a lib in the set "netcdf":
--   Searching for lib 'netcdf' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so'
-- Searching for a lib in the set "pnetcdf":
--   Searching for lib 'pnetcdf' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libpnetcdf.a'
-- Searching for a lib in the set "hdf5_hl":
--   Searching for lib 'hdf5_hl' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5_hl.a'
-- Searching for a lib in the set "hdf5":
--   Searching for lib 'hdf5' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5.a'
-- Searching for a lib in the set "z":
--   Searching for lib 'z' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib/libz.so'
-- TPL_Netcdf_LIBRARIES='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so;/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libpnetcdf.a;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5_hl.a;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5.a;/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib/libz.so'
-- TPL_Netcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'

This shows that the updated FindTPLNetcdf.cmake module breaks backward compatibility and will break people's existing configures who are using the TriBITS TPL system standard vars Netcdf_INCLUDE_DIRS, Netcdf_LIBRARY_DIRS and Netcdf_LIBRARIES.

bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this pull request Feb 23, 2017
Now it responds to the standard TriBITS vars Netcdf_INCLUDE_DIRS,
Netcdf_LIBRARY_NAMES, or Netcdf_LIBRARY_DIRS if set correctly.
@gsjaardema
Copy link
Contributor Author

The current NetCDF patch uses the paths NetCDF_LIBRARIES and NetCDF_INCLUDE_DIRS instead of Netcdf_INCLUDE_DIRS and Netcdf_LIBRARIES.

Perhaps the Netcdf versions should emit a deprecated warning and indicate a preference for the NetCDF versions since NetCDF is a more accepted (in the NetCDF community) way of specifying the library than "Netcdf"

I think this was discussed earlier, but not sure where that discussion is archived...

@bartlettroscoe
Copy link
Member

This is unfortunate and confusing. Whoever named the TriBITS TPL with the case "Netcdf" instead of the standard CMake find module name with case "NetCDF" did a disservice. This difference is going to confuse people to no end. But it would be hard to change the Trilinos TriBITS TPL name back to "NetCDF" but perhaps we should do it? I think we might be able to preserve backward compatiblity with a warning perhaps but it would be messy.

bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this pull request Feb 24, 2017
Setting this does nothing and therefore should be removed.

However, it is not clear why FindTPLPnetcdf.cmake is even part of the PR since
it does not impact SEACAS in any way.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this pull request Feb 24, 2017
According to the standard defined in the TriBITS Developers Guide, the
FIND_PACKAGE() command optionally finds the TPL.  If that fails, then the
standard TriBITS find can take a crack at it.

Without this, then we are techically breaking backward compatibility.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this pull request Feb 24, 2017
…vars (TriBITSPub#156)

This now matches the standard behavior defined in the TriBITS Developers
Guide.

The FIND_PACKAGE(CGNS) call was made optional as per the standard.  But that
should be okay because if that fails, then if the standard TriBITS TPL find
fails, then the TPL find will bomb out.
bartlettroscoe added a commit to bartlettroscoe/Trilinos that referenced this pull request Feb 24, 2017
…rilinos#1086)

I also removed other find modules already being pulled in from TriBITS.

This goes with TriBITSPub/TriBITS#156.
@bartlettroscoe
Copy link
Member

I have updated the FindTPLNetcdf.cmake, FindTPLPnetcdf.cmake and FindTPLCGNS.cmake to the branch:

I am ready to have the SNL customer review this. I will comment on how to do that in:


DETAILED NOTES:

Now to fix the updated FindTPL<TPL_NAME>.cmake files according to:

The files that I need to update are:

$ git diff --name-status HEAD ^github/master -- tribits/common_tpls/*.cmake
A       tribits/common_tpls/FindTPLCGNS.cmake
A       tribits/common_tpls/FindTPLNetcdf.cmake
A       tribits/common_tpls/FindTPLPnetcdf.cmake

Just three files to update. This should not be too bad.

I just pushed the commit:

392f435 "Update to TriBITS standard (#156)"
Author: Roscoe A. Bartlett <[email protected]>
Date:   Thu Feb 23 14:51:50 2017 -0700 (9 minutes ago)

M       tribits/common_tpls/FindTPLNetcdf.cmake
M       tribits/common_tpls/find_modules/FindNetCDF.cmake

to the branch:

I tested this with the SEMS env and it configures correctly with:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
-- Searching for libs in Netcdf_LIBRARY_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib;/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib'
-- Searching for a lib in the set "netcdf":
--   Searching for lib 'netcdf' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so'
-- Searching for a lib in the set "pnetcdf":
--   Searching for lib 'pnetcdf' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libpnetcdf.a'
-- Searching for a lib in the set "hdf5_hl":
--   Searching for lib 'hdf5_hl' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5_hl.a'
-- Searching for a lib in the set "hdf5":
--   Searching for lib 'hdf5' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5.a'
-- Searching for a lib in the set "z":
--   Searching for lib 'z' ...
--     Found lib '/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib/libz.so'
-- TPL_Netcdf_LIBRARIES='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so;/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libpnetcdf.a;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5_hl.a;/projects/sems/install/rhel6-x86_64/sems/tpl/hdf5/1.8.12/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libhdf5.a;/projects/sems/install/rhel6-x86_64/sems/tpl/zlib/1.2.8/gcc/4.8.4/base/lib/libz.so'
-- TPL_Netcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'

But if I turn off the special include of SEMSEnv.cmake by configuring with:

$ time ./do-configure \
    -DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
    -DTrilinos_ENABLE_SEACAS=ON \
    -DTrilinos_USE_BUILD_ENV= \
    &> configure.out

real    0m6.789s
user    0m3.716s
sys     0m2.055s

you get a configure failure with:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
-- Using FIND_PACKAGE(Netcdf ...) ...
CMake Error at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:163 (message):
  Can not locate NetCDF include directory
Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:66 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


CMake Error at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:274 (message):
  Can not locate NetCDF C library
Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:66 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- NetCDF does not require HDF5
-- NetCDF does not require PNetCDF
-- Can not locate NetCDF bin directory
CMake Error at /ascldap/users/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find NetCDF (missing: NetCDF_LIBRARIES NetCDF_INCLUDE_DIRS)
Call Stack (most recent call first):
  /ascldap/users/projects/sems/install/rhel6-x86_64/sems/utility/cmake/3.5.2/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:430 (find_package_handle_standard_args)
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:66 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- Configuring incomplete, errors occurred!

So it shows that it is using FIND_PACKAGE(NetCDF ...) when the vars Netcdf_LIBRARY_DIRS, etc. are not set.

But when I restore the SEMS-set PATH var and configure with:

$ time ./do-configure \
    -DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
    -DTrilinos_ENABLE_SEACAS=ON \
    -DTrilinos_USE_BUILD_ENV= \
    &> configure.out

real    0m8.770s
user    0m5.845s
sys     0m2.351s

I get:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
-- Using FIND_PACKAGE(Netcdf ...) ...
-- NetCDF include file /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include/netcdf.h will be searched for define values
CMake Warning at TriBITS/tribits/common_tpls/find_modules/FindNetCDF.cmake:184 (message):
  WARNING: The NetCDF found in does not have the correct NC_MAX_DIMS and
  NC_MAX_VARS.  It may not be compatible with Exodus.  See NetCDF-Mapping.md
  for details

Call Stack (most recent call first):
  TriBITS/tribits/common_tpls/FindTPLNetcdf.cmake:66 (find_package)
  TriBITS/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:89 (INCLUDE)
  TriBITS/tribits/core/package_arch/TribitsGlobalMacros.cmake:1614 (TRIBITS_PROCESS_ENABLED_TPL)
  TriBITS/tribits/core/package_arch/TribitsProjectImpl.cmake:202 (TRIBITS_PROCESS_ENABLED_TPLS)
  TriBITS/tribits/core/package_arch/TribitsProject.cmake:93 (TRIBITS_PROJECT_IMPL)
  CMakeLists.txt:93 (TRIBITS_PROJECT)


-- NetCDF does not require HDF5
-- NetCDF does not require PNetCDF
-- Found NetCDF: /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so  
-- NetCDF Version: 
-- 	NetCDF_NEEDS_HDF5        = 
-- 	NetCDF_NEEDS_PNetCDF     = 
-- 	NetCDF_PARALLEL          = False
-- 	NetCDF_INCLUDE_DIRS      = /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include
-- 	NetCDF_LIBRARIES         = /projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so
-- 	NetCDF_BINARIES          = ncdump;ncgen;nccopy
-- TPL_Netcdf_LIBRARIES='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libnetcdf.so'
-- TPL_Netcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'

That shows that the updated FindTPLNetcdf.cmake module supports both the new (better) default find operation, but still supports the old TriBITS vars that are used by many existing clients.

Now to modify the other two find modules FindTPLCGNS.cmake and FindTPLPnetcdf.cmake accordingly.

It does not look like the Pnetcdf.cmake module is used by SEACAS in Trilinos as shown by:

$ cd ../packages/seacas/
$ find . -name Dependencies.cmake -exec grep -nHi pnetcdf {} \;

Looking at the SEACAS version that exists on Greg's seacas GitHub repo, it does not seem that it uses the Pnetcdf TPL either.

What is up with that?

It looks like the only package that uses the "Pnetcdf" TPL in Trilinos is Trios:

[rabartl@crf450 packages (netcdf-cgns-hdf5-1082)]$ find . -name Dependencies.cmake -exec grep -nHi pnetcdf {} \;
./trios/cmake/Dependencies.cmake:17:SET(LIB_OPTIONAL_DEP_TPLS BGQPAMI BGPDCMF MPI Netcdf Pnetcdf Pthread CrayPortals Portals Gemini InfiniBand Pablo PAPI HPCToolkit)
./trios/services/netcdf/cmake/Dependencies.cmake:5:SET(LIB_REQUIRED_DEP_TPLS MPI Pnetcdf Netcdf)
./trios/services/netcdf/src/cmake/Dependencies.cmake:5:SET(LIB_REQUIRED_DEP_TPLS MPI Pnetcdf Netcdf)
./trios/services/netcdf/tests/cmake/Dependencies.cmake:5:SET(LIB_REQUIRED_DEP_TPLS MPI Pnetcdf Netcdf)

But Trios is an "EX" package and never gets tested in automated testing.

In any case, since the SEMS env has a Pnetcdf TPL installed, I can test this module manually by configuring with -DTPL_ENABLE_Pnetcdf=ON and testing it with and without the overrides. That is what I will do.

Okay, so I looked at the updated FindTPLPnetcdf.cmake file and it does not use FIND_PACKAGE(...). The only difference with what is in Trilinos/cmake/TPLs/FindTPLPnetcdf.cmake is a copyright/license and the do nothing set:

SET(CMAKE_MODULE_PATH
  "${CMAKE_MODULE_PATH}"
  "${CMAKE_CURRENT_LIST_DIR}/find_modules"
  "${CMAKE_CURRENT_LIST_DIR}/utils"
   )

Therefore, I am just going to take that out and delete the find module from Trilinos/cmake/TPLs/.

I tested the FindTPLPnetcdf.cmake module with:

$ ./do-configure  -DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
   -DTPL_ENABLE_Pnetcdf=ON \
   -DPnetcdf_LIBRARY_DIRS=$SEMS_NETCDF_LIBRARY_PATH \
   -DPnetcdf_INCLUDE_DIRS=$SEMS_NETCDF_INCLUDE_PATH \
   &> configure.out

and this passed showing the configure output:

Processing enabled TPL: Pnetcdf (enabled explicitly, disable with -DTPL_ENABLE_Pnetcdf=OFF)
-- TPL_Pnetcdf_LIBRARIES='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/lib/libpnetcdf.a'
-- Searching for headers in Pnetcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'
-- Searching for a header file in the set "pnetcdf.h":
--   Searching for header 'pnetcdf.h' ...
--     Found header '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include/pnetcdf.h'
-- Found TPL 'Pnetcdf' include dirs '/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'
-- TPL_Pnetcdf_INCLUDE_DIRS='/projects/sems/install/rhel6-x86_64/sems/tpl/netcdf/4.3.2/gcc/4.8.4/openmpi/1.8.7/parallel/include'

I also deleted the duplicate FindTPL<TPL_NAME>.cmake modules in Trilinos/cmake/TPLs/.

Now for FindTPLCGNS.cmake. I don't have that TPL, but I can see if it tries to find it after I update it.

I made the similar updates and did some manual testing (the best I could without having a CGNS lib on my system).

I pushed the updated code to the branch:

To [email protected]:bartlettroscoe/TriBITS.git
   392f435..a5f7169  netcdf-cgns-hdf5-156 -> netcdf-cgns-hdf5-156

In addition, I pushed the corresponding Trilinos changes and cleanups to the branch:

To [email protected]:bartlettroscoe/Trilinos
 * [new branch]      netcdf-cgns-hdf5-1082 -> netcdf-cgns-hdf5-1082

@gsjaardema
Copy link
Contributor Author

gsjaardema commented Feb 24, 2017 via email

@gsjaardema
Copy link
Contributor Author

gsjaardema commented Feb 24, 2017 via email

@bartlettroscoe
Copy link
Member

@gsjaardema,

Thanks for the detail. What that means is that the pnetcdf library is lumped together with the netcdf library into the same TriBITS TPL "Netcdf" (which is found using FindNetCDF.cmake). That means that we can eliminate the FindTPLPnetcdf.cmake TPL from this PR.

@gsjaardema
Copy link
Contributor Author

gsjaardema commented Feb 24, 2017 via email

@bartlettroscoe
Copy link
Member

NO! They are separate libraries; it is just that NetCDF can depend on PnetCDF during certain configurations. Similar to HDF5 being a dependence of NetCDF and CGNS.

@gsjaardema, I think there is some confusion here between a "TriBITS TPL" and a "library". I will call you to clear this up.

@bartlettroscoe
Copy link
Member

I talked with @gsjaardema. He is going to look at the file FindTPLPnetcdf.cmake to call FIND_PACKAGE(PnetCDF) to make to make it consistent with FindTPLNetcdf.cmake (but recognizes that FindTPLPnetcdf.cmake does not impact SEACAS at all because none of the SEACAS subpackages declare a dependency on the TriBITS TPL "Pnetcdf" in its Dependencies.cmake module).

@gsjaardema agreed to review any suggested changes to any of these find modules related to HDF5, CGNS, PNetcdf, and Netcdf since I don't have a way to evaluate if they will break all use cases (but I can test the use cases that I know about and know how to reproduce).

We also discussed the issue of documentation for these new customized find modules. After committing these to TriBITS and Trilinos, the default find will use the new FindHDF5.cmake, FindNetCDF.cmake, etc. modules that take a number of different variables like HDF5_ROOT, NetCDF_ROOT that users of Trilinos would have no knowledge about. They are not even defined as CMake cache vars so the user never know about them unless they looked at the custom FindHDF5.cmake and FindNetCDF.cmake files themselves.

Therefore, as a follow-on to this, we will need to work out how to manage the documentation for these different custom FindTPL<TPL_NAME>.cmake find modules. The idea I had was to use restructured text at the top of the file FindTPL<TPL_NAME>.cmake files and then update the TriBITS system that extracts documentation to build the <Project>BuildReference.rst document. To start out with, we might just require manually listing the FindTPL<TPL_NAME>.cmake to extract documentation from for any individual TriBITS project, and then extract the documentation for it and put it into the generated <Project>BuildReference.rst. This is the only way that I can see to avoid duplication of this documentation.

Otherwise, after some customer-specific testing, I am ready to push this.

@bartlettroscoe bartlettroscoe merged commit f4453ee into TriBITSPub:master Feb 24, 2017
@bartlettroscoe
Copy link
Member

@gsjaardema, how to you tell this new set of find modules where to find libz? I can't seem to tell it to find the version that I want. Instead, it is finding the default version as shown by:

Processing enabled TPL: Netcdf (enabled explicitly, disable with -DTPL_ENABLE_Netcdf=OFF)
-- Using FIND_PACKAGE(Netcdf ...) ...
[ ... ]
-- 	HDF5_LIBRARIES         =/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/hdf5-1.8.10/lib/libhdf5_hl.so;/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/hdf5-1.8.10/lib/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libm.so

That is not the libz that I want to find.

For the TriBITS "Zlib" TPL, you just point to it with Zlib_INCLUDE_DIRS and Zlib_LIBRARY_DIRS and it finds it as:

Processing enabled TPL: Zlib (enabled explicitly, disable with -DTPL_ENABLE_Zlib=OFF)
-- Searching for libs in Zlib_LIBRARY_DIRS='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/lib'
-- Searching for a lib in the set "z":
--   Searching for lib 'z' ...
--     Found lib '/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/lib/libz.so'
-- TPL_Zlib_LIBRARIES='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/lib/libz.so'
-- Searching for headers in Zlib_INCLUDE_DIRS='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/include'
-- Searching for a header file in the set "zlib.h":
--   Searching for header 'zlib.h' ...
--     Found header '/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/include/zlib.h'
-- Found TPL 'Zlib' include dirs '/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/include'
-- TPL_Zlib_INCLUDE_DIRS='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/include'

Even FindHDF5.cmake is finding the right libz:

Processing enabled TPL: HDF5 (enabled explicitly, disable with -DTPL_ENABLE_HDF5=OFF)
-- Using FIND_PACKAGE(HDF5 ...) ...
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /ascldap/users/vera_env/gcc-4.8.3/tpls/opt/hdf5-1.8.10/lib/libhdf5.so;/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/lib/libz.so;/usr/lib64/libm.so (found version "1.8.10") found components:  C 
-- TPL_HDF5_LIBRARIES='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/hdf5-1.8.10/lib/libhdf5.so;/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/lib/libz.so;/usr/lib64/libm.so'
-- TPL_HDF5_INCLUDE_DIRS='/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/hdf5-1.8.10/include;/ascldap/users/vera_env/gcc-4.8.3/tpls/opt/zlib-1.2.7/include'

What is it about this custom FindNetCDF.cmake file that is finding the wrong zlib? How can I tell it what zlib to find?

@gsjaardema
Copy link
Contributor Author

The FindNetCDF.cmake should not be doing anything with libz. It only detects that it has a dependency on HDF5 and relies on the FindHDF5.cmake to take car of adding the libhdf5_hl and libhdf5 and any libraries that these depend on (libz and potentially libdylib). I think that the hdf5 configuration has the pointer to the libz that was used or found when it was built.

@bartlettroscoe
Copy link
Member

I think that the hdf5 configuration has the pointer to the libz that was used or found when it was built.

It does not seem to. If you look above, you can see that FIND_PACKAGE(HDF5) found the right libz.* file when called from the FindTPLHDF.cmake module. The output from FIND_PACKAGE(NetCDF) does not give any indication that I can see how it is finding libz.* but it is the wrong file.

This is not going to break any of my current use cases for Trilinos or CASL VERA because we just use the old TriBITS system and set these explicitly and will not use the default FIND_PACKAGE() calls. But let's see if the SNL customer has a problem with this or not. If not, then no reason to worry about this too much.

SideNote: This is why it would be better to upgrade TriBITS so that TPLs can property depend on each other and then FIND_PACKAGE(<SomeTpl>) would be called only once for any <SomeTpl> and then downstream TPLs would get the list of libraries and include dirs from upstream TPLs. So "Netcdf" wold depend on "Pnetcdf" which would depend on "HDF5" which would depend on "Zlib". Otherwise, I don't know how to get my hands around this. But this will not happen until I can get to #63 (which seems like it may never happen unless I can run away hide for a good chunk of time).

@jrood-nrel
Copy link

Thanks for working on this. In my initial testing of this in Trilinos is that it is not working how I expect. I am requiring linking of PNetCDF in the case that I am using SEACAS for my project, indirectly depending on PNetCDF as described. I am also using Spack, so I am trying to generalize the Trilinos package file in this manner:

            '-DTPL_ENABLE_Netcdf:STRING=ON',
            '-DNetcdf_INCLUDE_DIRS:PATH=%s' % spec['netcdf'].prefix.include,
            '-DNetcdf_LIBRARY_DIRS:PATH=%s' % spec['netcdf'].prefix.lib,
            '-DTPL_Netcdf_Enables_Netcdf4:BOOL=TRUE',
            '-DTPL_Netcdf_PARALLEL:BOOL=ON',
            '-DTPL_ENABLE_Pnetcdf:BOOL=ON',
            '-DPnetcdf_INCLUDE_DIRS:PATH=%s' % spec['parallel-netcdf'].prefix.include,
            '-DPnetcdf_LIBRARY_DIRS:PATH=%s' % spec['parallel-netcdf'].prefix.lib,

However, something regarding NetCDF or PNetCDF isn't being included on the link line and my build fails with obvious missing symbols related to them. Previously I would inject the PNetCDF libraries in a less portable fashion into the NetCDF link line with:

            '-DTPL_ENABLE_Netcdf:STRING=ON',
            '-DNetcdf_INCLUDE_DIRS:PATH=%s;%s' % (spec['netcdf'].prefix.include, spec['parallel-netcdf'].prefix.include),
            '-DNetcdf_LIBRARY_DIRS:PATH=%s;%s' % (spec['netcdf'].prefix.lib, spec['parallel-netcdf'].prefix.lib),
            '-DTPL_Netcdf_LIBRARIES:PATH=%s;%s' % (spec['netcdf'].prefix.lib + '/libnetcdf.a', spec['parallel-netcdf'].prefix.lib + '/libpnetcdf.a'),

Before I investigate this further, I just wanted to make sure that the CMake defines in my first code block are what you would expect I should be doing now that this has been merged, i.e. do I appear to be doing anything obviously wrong there?

@bartlettroscoe
Copy link
Member

@gsjaardema, can respond in more detail but I think what you want is just:

            '-DTPL_ENABLE_Netcdf=ON',
            '-DNetCDF_ROOT:PATH=%s' % spec['netcdf'].prefix.,

@gsjaardema
Copy link
Contributor Author

@bartlettroscoe The two lines you show should be correct. You should also add a similar line for PNetCDF_ROOT which would be used by FindNetCDF.cmake if it discovers that PNetCDF is an (optional) dependency of NetCDF.

@jrood-nrel
Copy link

I just tested this using your recommendation (I used _ROOT for all my TPLs) and it worked! This is great! Thanks again for doing this. Helps make the dependency on PNetCDF much more portable, and I can push this functionality into Spack.

krcb pushed a commit to Tech-XCorp/Trilinos that referenced this pull request Mar 29, 2017
…rilinos#1086)

I also removed other find modules already being pulled in from TriBITS.

This goes with TriBITSPub/TriBITS#156.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants