Use RAII approaches for hardware information detection
commita679255810eab55597b7e026fefa9c6d7509bb59
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 21 May 2019 20:59:26 +0000 (21 22:59 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 11 Jun 2019 16:05:02 +0000 (11 18:05 +0200)
tree4c136faaeb76720e02e39fbdffd8b7b8f4bda923
parent5607ca0bee305561075639e34c37dacba6eaf2fd
Use RAII approaches for hardware information detection

Eliminated gmx_hardware_info_free. The lifetime of the hardware info
should be from the first time it is needed until the end of the
process, and in particular its ownership should not be related to the
lifetime of any threads implementing mdrun.

The implementation of gmx_detect_hardware now uses a simple mutex and
file static smart pointer to hold the data, lazily create it, and leave
it to process cleanup to call the destructor to free resources. Helper
functions no longer refer to the static smart pointer directly.

Internal data structures of gmx_hw_info_t are now held by smart pointer rather
than needing manual memory cleanup.

Extended not_null to be able to be created from smart pointers, and
tested the new behaviours.

Reduced the header dependencies of detecthardware.cpp, now that it
doesn't do all the string handling of printhardware.cpp

Change-Id: I9d5cd838dc6e214163cf2e3104e0f7aaa356fcf8
src/gromacs/compat/pointers.h
src/gromacs/compat/tests/pointers.cpp
src/gromacs/ewald/tests/testhardwarecontexts.cpp
src/gromacs/ewald/tests/testhardwarecontexts.h
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/detecthardware.h
src/gromacs/hardware/hw_info.h
src/gromacs/mdrun/runner.cpp