-
Notifications
You must be signed in to change notification settings - Fork 564
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
Tpetra: Add a way to query environment variables #654
Comments
Here is the interface I would like (omitting details relating to singleton initialization and finalization; use atexit() hook to finalize). Put in a new header file called Tpetra_Details_Environment.hpp in tpetra/core/src.
|
Thinking out loud : Can this be in Trilinos name space and in a place like Teuchos ? Seems much more useful at the larger scale. |
Could std::getenv be of use here? Since CXX11 this function is thread-safe as long as no other function modifies the environment: |
@srajama1 wrote:
We could test in Tpetra first, then deploy in Teuchos once we're confident that it works. Breaking Teuchos is even higher consequence than breaking Tpetra :-) |
@krcb wrote:
Yes; thanks! |
Progress report: @tjfulle wrote an initial implementation and stand-alone test. I reviewed the implementation and gave some comments on refining the interface. Next step after that is to integrate this into Trilinos' unit test framework. |
Adds Tpetra::Details::Environment singleton class: - query system for environment variables - cache retrieved environment variables - cache default variables on instantiation (TPETRA_DEBUG, TPETRA_USE_BLAS) - setting environment variables capability is disabled Commit also provides an updated method of loading configuration files with the checkin-test.py script, allowing configuration files to have extensions different than '.py' Addresses: #654, #684, #688 Build/Test Cases Summary Enabled Packages: TpetraCore, Ifpack2, Belos, Amesos2, Zoltan2, Xpetra, MueLu, Stokhos, Sacado Disabled Packages: SEACAS,STK,Shards,FEI,ROL,Moertel,Panzer,ThreadPool,OptiPack,Rythmos,Intrepid,PyTrilinos 0) MPI_DEBUG => passed: passed=515,notpassed=0 (11.04 min)
I'm calling this closed. Thanks @tjfulle ! |
@trilinos/tpetra
Add a way for Tpetra to query environment variables. This would be useful for making more debug options available at run time, so that users wouldn't have to recompile their release build of Trilinos in order to get some useful debug information. It would also be useful for debugging issues like #423, which relate to downstream packages or applications making incorrect assumptions (e.g., that stride == local # rows, which is not true if padding is enabled).
It may make sense to cache results of looking up an environment variable, in order to avoid overhead of system calls.
It would make sense to design this as a singleton class. This would make it easier to ensure thread safety by locking use of getenv(). POSIX getenv() does not promise thread safety:
http://pubs.opengroup.org/onlinepubs/009695399/functions/getenv.html
though Linux's implementation of getenv() does promise thread safety:
http://man7.org/linux/man-pages/man3/getenv.3.html
The text was updated successfully, but these errors were encountered: