![]() |
OpenMS
|
The following contains answers to typical questions from developers about OpenMS.
Follow the Coding Conventions.
To summarize:
tools/checker.php. Call php tools/checker.php for detailed instructions. Please open a pull request and follow the pull request guidelines.
START_SECTION-macro for class tests not handle template methods that have two or more arguments?Insert round brackets around the method declaration.
View the binary installers at the build archive.
Please verify the creation date of the individual installers, as there may have been an error while creating the installer.
The following questions are related to the build system.
View the cmake website for more information.
CMake cache variables?User definable CMake cache variables allow the user to pass options to CMake which will influence the build system. The most important option that should be given when calling CMake is:
CMAKE_PREFIX_PATH, which is where CMake will search for additional libraries if they are not found in the default system paths. By default we add OpenMS/contrib.
If you have installed all libraries on your system already, there is no need to change CMAKE_PREFIX_PATH. For contrib libraries, set the variable CMAKE_PREFIX_PATH.
On Windows, the contrib folder is required, as there are no system developer packages. To pass this variable to CMake use the -D switch e.g. cmake -D CMAKE_PREFIX_PATH:PATH="D:\\somepath\\contrib".
Everything else can be edited using ccmake afterwards.
See Building OpenMS on GNU/Linux, Building OpenMS on Mac OS X, Building OpenMS on Windows for more flags.
View the description for each option by calling ccmake.
No. Additionally, if COINOR is found during the CMake step, it is preferred over GLPK. Refer to the documentation of the LPWrapper class, on how to abstract your code.
contrib path, but re-running CMake won't change the library paths?Once a library is found and its location is stored in a cache variable, it will only be searched again if the corresponding entry in the cache file is set to false.
CMakeCache.txt, all other custom settings will be lost.The most useful targets will be shown to you by calling the targets target, i.e. make targets.
CMake can't seem to find a Qt library (usually QtCore).CMake finds QT by looking for qmake in your PATH or for the Environment Variable QTDIR. Set these accordingly.
Make sure there is no second installation of Qt (especially the MinGW version) in your local environment.
CMake to the wrong path (it's searching for the Qt*.lib files). You should only move or delete the offending Qt version if you know what you are doing.A save workaround is to edit the CMakeCache file (e.g. via ccmake) and set all paths relating to QT (e.g. QT_LIBRARY_DIR) manually.
It is recommended to use the latest version. Get the latest CMake, as its generator needs to support your VS. If your VS is too new and there is no CMake for that yet, you're gonna be faced with a lot of conversion issues. This happens whenever the Build-System calls CMake (which can be quite often, e.g., after changes to CMakeLists.txt).
To speed up the compile process of OpenMS, use several threads. In general, the ninja generator (as opposed to make) uses all CPU cores by default, which may be more convenient to you. With make-based generators, supply the number of parallel jobs manually, e.g. make -j20.
On Windows, Visual Studio solution files are automatically build with the /MP flag, such that Visual Studio uses all available cores of the machine.
We currently employ Github Actions (GHA), for the majority of our CI. See <OpenMS>/.github/workflows/openms_ci_matrix_full.yml for the full CI build script which gets run for every PR.
We are currently phasing out Travis.
travis work?Travis is an automated system for continuous integration and each new commit and pull request is automatically run through the travis build system. This is controlled by a .travis.yaml file in the source tree.
source/TEST and source/APPLICATIONS/TOPP folder?All source files added to an IDE are associated with their targets. Find the source files for each test within its own subproject. The same is true for the TOPP classes.
Thus, open the correct project (e.g. for Visual Studio find the correct .sln file) in the build tree.
Depending on the Visual Studio version it might get an error like Error while formating with ClangFormat. This is because Visual Studio is using an outdated version of clang-format. Unfortunately there is no easy way to update this using Visual Studio itself. There is a plugin provided by LLVM designed to fix this problem, but the plugin doesn't work with every Visual Studio version. In that case, update clang-format manually using the pre-build clang-format binary. Both the binary and a link to the plugin can be found here. To update clang-format download the binary and exchange it with the clang-format binary in your Visual Studio folder. For Visual Studio 19 it should be located at: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/bin.
Class tests are unit tests that typically test the functionality of a class. They get built as standalone "additional" executables that include the class to be tested and the testing utility classes to test outcomes of single functions of the class. Unless you've added functions that are intended to be used outside of your new additional mode, you don't need to add anything.
Tool tests are using the tool executable that the user would also receive. We use those executables to run the full algorithm on a small test dataset, to ensure that from version to version, the results stay the same.
Each TOPP test consists of:
.ini file). FuzzyDiff call that compares the temporary output file of the last call and a reference test output that you have to provide. FuzzyDiff call on the actual executable call (so they get executed after each other). Use e.g., ctest -V -R IDMapper to only test tests that include the regex IDMapper (-V is just verbose). Make sure to build the IDMapper and IDMapper_test executable after it is edited. ctest does not have any automatic dependency on the timestamps of the executables. See <OpenMS>/src/tests/topp/CMakeLists.txt for examples.
Write a test to every new class added to OpenMS.
To add a test:
src/tests/class_tests/<sub-project>/ (e.g., src/tests/class_tests/openms/source/NewFileFormat_test.cpp). executables.cmake file in the test folder. git add A test template for your specific class can be generated using the create_test.php script found in tools/.
To generate a test template:
make xml. Suppose you want to create a GUI class for the class called MyClass. To add a new GUI test:
MyClass_test.cpp in src/tests/class_tests/openms_gui/source. src/tests/class_tests/openms_gui/CMakeLists.txt in the GUI section. make_testCheck the LD_LIBRARY_PATH environment variable:
Print the LD_LIBRARY_PATH with echo $LD_LIBRARY_PATH. If your /lib/ folder is included, check that libOpenMS.so is present. With the ldd command, you can show the libraries used by an executable, e.g. ldd /bin/ClassTest_test.
The following section provides information on how to debug your code.
Linux: Use ldd.
Windows (Visual studio console): See Dependency Walker. Use the x64 version for 64 bit builds. Using the wrong version of depends.exe will give the wrong results. Or dumpbin /DEPENDENTS OpenMS.dll.
Linux: Use nm <library>.
Use nm -C to switch on demangling of low-level symbols into their C++-equivalent names. nm also accepts .a and .o files.
Windows (Visual studio console): Use dumpbin /ALL <library>.
Use dumpbin on object files (.o) or (shared) library files (.lib) or the DLL itself e.g. dumpbin /EXPORTS OpenMS.dll.
To just obtain overall runtime and peak RAM usage of a TOPP tool, the easiest is probably /usr/bin/time (or https://github.com/cbielow/wintime for Windows). However, each TOPP tool will report those numbers at the end of its run anyways.
Windows: this is directly supported by Visual Studio (Depending on the edition: Team and above). Follow their documentation.
Linux: For profiling, perf is usually a very good starting point (see https://perf.wiki.kernel.org/index.php/Main_Page). Make sure to build OpenMS with debug symbols in Release mode, e.g. cmake -DMY_CXX_FLAGS="-g;-fno-omit-frame-pointer" -DCMAKE_BUILD_TYPE=Release <more flags here>. Then compile OpenMS and run perf stat (overview) or record (detailed statistics down to function level):
We recommend hotspot (https://github.com/KDAB/hotspot) to view inspect the resulting perf.data (or use perf report). Further reading http://sandsoftwaresound.net/perf/perf-tutorial-hot-spots/ .
Alternatively, try Valgrind (warning: very long runtimes, up to factor 100x):
CMAKE_BUILD_TYPE to Debug). valgrind –tool=callgrind. valgrind with the option –instr-atstart=no. callgrind -i [on|off] to start/stop the profiling. kcachegrind callgrind.out. Another option is IBM's profiler, available for all platforms (and free for academic use): Purify(Plus) and/or Quantify.
Use the AddressSanitizer, which comes with g++/clang these days. See Building OpenMS on GNU/Linux for details on how to compile it into OpenMS.
CMAKE_BUILD_TYPE to Debug). valgrind: valgrind –suppressions=OpenMS/tools/valgrind/openms_external.supp –leak-check=full <executable> <parameters>. Common errors are:
Invalid write/read ... - Violation of container boundaries. ... depends on uninitialized variable - Uninitialized variables. ... definitely lost - Memory leak that has to be fixed. ... possibly lost - Possible memory leak, so have a look at the code. For more information see the valgrind documentation.
View preparation of a new OpenMS release to learn more about contributing to releases.