In this tutorial we explain how to download and use the tutorials using the command-line, Eclipse IDE, and CLion IDE.
Downloading the Tutorials
Dependencies:
- HTGS (See Getting Started)
- cmake v2.7+
- gcc/g++ v4.8.x (or higher, C++11)
- pthreads
- (Optional) Graphviz
- (Optional, except Tutorials 3b and 6) OpenBLAS
- (Optional, except for Tutorials 4, 5, 7, and 8) CUDA (Requires one or more CUDA-Enabled GPUs on system)
CMake Options:
HTGS_INCLUDE_DIR - HTGS include directory, example: /usr/local/include
OpenBLAS - OpenBLAS home directory, example /usr/local OpenBLAS_LIB - OpenBLAS lib directory OpenBLAS_INCLUDE_DIR - OpenBLAS include directory
:$ git clone https://github.com/usnistgov/HTGS-Tutorials.git
:$ cd <HTGS_Tutorials_Directory>
:<HTGS_Tutorials_Directory>$ mkdir build && cd build
:<HTGS_Tutorials_Directory>/build$ ccmake ../ (or cmake-gui)
'Configure' and setup cmake parameters
'Configure' and 'Build'
:<HTGS_Tutorials_Directory>/build$ make
Getting Started using the Command-Line
- Clone HTGS-Tutorials as shown above and navigate to <HTGS_TUTORIALS_DIRECTORY>
- Create and navigate into build directory
- Run ccmake ../ or cmake-gui ../
- Configure CMake Options and specify build type: i.e. Release or Debug
- Run make
- Tutorial executables are now available in their associated directories (tutorial1, tutorial2, etc.)
Getting Started using Eclipse CDT
- Download Eclipse CDT from here
- Run Eclipse and download cmake4eclipse
- Help -> Eclipse Marketplace
- Find cmake4eclipse
- Restart eclipse
- Import HTGS Tutorials
- Configure as C/C++ project
- Right click HTGS-Tutorials in Project Explorer
- New->Convert to a C/C++ Project
- Project type:->Executable
- Finish
- Configure CMake builder and parameters
- Right click HTGS-Tutorials in Project Explorer
- Properties
- C/C++ Build-> Ensure Generate Makefiles automically is checked
- C/C++ Build Dropdown->CMake->Symbols
- Add CMake cache entries to define (-D)
- Variable name: HTGS_INCLUDE_DIR
- Type: FILEPATH
- Value: PATH_TO_HTGS
- Variable name: OpenBLAS
- Type: FILEPATH
- Value: PATH_TO_OPENBLAS_PREFIX_DIR
- C/C++ Build Dropdown->Tool Chain Editor
- Current builder: CMake Make Builder
- You should be able to build the HTGS-Tutorials
Getting Started on Windows with Visual Studio
- Clone HTGS-Tutorials as shown above and store it in a known directory (see step 6 for git bash)
- Download Microsoft Visual Studio Community from here
- Run Visual Studio and open a new Win32 project
- Select default options and click Finish
- Add HTGS source files
- Right-click on Solution in Solution Explorer
- Properties > C/C++ > General > Additional Include Directories
- Write <HTGS source="" directory>="">, which denotes where the #include statements will path from
- To compile, go to Build > Build solution to generate the .exe file.
- The program will be made in <VISUAL STUDIO LOCATION>/Projects/<PROJECT NAME>/Debug
- Optional programs for Windows
- Windows Powershell is useful for easily running .exe's and for navigating directories with bash. It sometimes comes installed on Windows by default or can otherwise be downloaded here.
- A command-line version of git can be found here.
Notes:
- Ensure that #include "stdafx.h" is the very first statement in every source file
- In Visual Studio's Solution Explorer you can make "New Filter"s to categorize task, rules, etc. but this is not the same as a new folder and should not be pathed as such in #include statements.
- When switching from 'Debug' to 'Release' in Visual Studio, you might get some strange errors. These might be fixed by change the 'Precompiled Headers' configuration: Right-click the Solution in the Solution Explorer; Properties > C/C++ > Precompiled Headers > Precompiled Header; change from 'Use (/Yu)' to 'Not Using Precompiled Headers'.
Getting Started using CLion