A project for High Performance Calculation
As follows
/ - working copy of repository (name irrelevant).
|- README.md - this file
|- bin/ - installed executables. Content .gitignored
|- build/ - cmake output files. Content .gitignored
|- doc/ - documentaation, notes.
|- include/ - headers for use with generated liraries in other projects
|- lib/ - installed libraries. Content .gitignored
`- hpc/ - project sources root
|- CMakeLists.txt
`- component_name/ - root of specific component sources
|- CMakeLists.txt
|- src/ - sources
| |- include/ - added to include dir. See Include Directories
| |- cpp/ - C++ source files.
| `- cuda/ - CUDA source files.
`- tests/ - for 75% sure Google Test sources.
Jump to Include Directories section.
In this section...
- Note, that installation prefix is fixed in hpc/CMakeLists.txt and points to root repository, which makes easy to just run
make install
and search for various binaries in singlebin
directory. TODO: make it parametrized with DEBUG/RELEASE build selection.
- CMake Version >= 2.8
- CUDA Compute Capability >= 3.0 (kepler)
- cd build
- cmake ../hpc
- make
- make install
Optionally replace steps 1 and 2 by
$ cmake -Bbuild -Hhpc
- navigate to bin directory
- run binaries of your choice
In this section...
in component, src/include directory should have following structure
src/
`- include/
`- <project name>/ - this is "hpc" for now.
`- <component_name>/
`- <file_name>.hpp
so when you include file A.hpp from component B in component C, you write
#include <hpc/B/A.hpp>
regardless of your current position in project. Even if you create file Utils.hpp in component X, you will never collide with someone else who use this name in component Y.
Combined with namespaces makes freedom for developer when it comes to name his files.
Directory src of component itself can contain private headers that are not to be exposed to other components. I suggest create directory "private" there and use simply
#include "private/HeaderName.hpp"
in C++ source files and other private headers, note:
- No public header is allowed to include private symbols!
Q: I got "You should not call cmake in-source..." error, why?
A: Becouse this will create heavily polluted working copy, which may result in accidentaly small kittens horrible death, total extinciton of Ailuropoda melanoleuca species or even adding binaries to version control. The solution is to re-read and understand Compilation Steps subsection of this file.