From 84d7cd2c8d724fd7d474a6f0a60a831a48221349 Mon Sep 17 00:00:00 2001 From: Haripriya Dhanasekaran Date: Wed, 22 Jan 2025 18:48:59 -0800 Subject: [PATCH 1/2] Created Conditional Compilation Switch for Testing --- CMakeLists.txt | 12 +++++++++++- Simulator/Core/Graphitti_Main.cpp | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cb09a2eb..e827429b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.12) #"YES" / GPU choice only available if CUDA library is installed and the GPU is CUDA capable. ############################################################################################ if(NOT ENABLE_CUDA) - set(ENABLE_CUDA NO) + set(ENABLE_CUDA YES) endif() #CONDITIONAL FLAG to turn on the performance metrics @@ -34,6 +34,11 @@ if(NOT GPROF) set(GPROF NO) endif() +#CONDITIONAL FLAG to turn on TESTING_MODE +if(NOT TESTING_MODE) + set(TESTING_MODE YES) +endif() + #Creates the Graphitti project with the correct languages, depending on if using GPU or not #If using CUDA, also verify the CUDA package and set the required CUDA variables if(ENABLE_CUDA) @@ -72,6 +77,11 @@ if(GPROF) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") endif() +if(TESTING_MODE) + message("-- Setting TESTING_MODE: ON") + add_definitions(-DTESTING_MODE) +endif() + #HDF5 Support, finds HDF5 package for C and C++ and links the hdf5 libraries to the executable \ # later in the file. find_package(HDF5 COMPONENTS C CXX) diff --git a/Simulator/Core/Graphitti_Main.cpp b/Simulator/Core/Graphitti_Main.cpp index 318e0a664..710e29c17 100644 --- a/Simulator/Core/Graphitti_Main.cpp +++ b/Simulator/Core/Graphitti_Main.cpp @@ -35,6 +35,10 @@ using namespace std; /// @return -1 if error, else 0 if success. int main(int argc, char *argv[]) { + #ifdef TESTING_MODE + cout << "Testing mode is ON \n"; + #endif + // Clear logging files at the start of each simulation fstream("Output/Debug/logging.txt", ios::out | ios::trunc); fstream("Output/Debug/vertices.txt", ios::out | ios::trunc); From a19667cd12dc31587ef6f6421bd3bc6a21ba133a Mon Sep 17 00:00:00 2001 From: Haripriya Dhanasekaran Date: Wed, 22 Jan 2025 20:36:07 -0800 Subject: [PATCH 2/2] Updated CMakeLists --- CMakeLists.txt | 2 +- Simulator/Core/Graphitti_Main.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e827429b3..2e8e9e646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.12) #"YES" / GPU choice only available if CUDA library is installed and the GPU is CUDA capable. ############################################################################################ if(NOT ENABLE_CUDA) - set(ENABLE_CUDA YES) + set(ENABLE_CUDA NO) endif() #CONDITIONAL FLAG to turn on the performance metrics diff --git a/Simulator/Core/Graphitti_Main.cpp b/Simulator/Core/Graphitti_Main.cpp index 710e29c17..bf8bdb1f3 100644 --- a/Simulator/Core/Graphitti_Main.cpp +++ b/Simulator/Core/Graphitti_Main.cpp @@ -35,10 +35,10 @@ using namespace std; /// @return -1 if error, else 0 if success. int main(int argc, char *argv[]) { - #ifdef TESTING_MODE - cout << "Testing mode is ON \n"; - #endif - +#ifdef TESTING_MODE + cout << "Testing mode is ON \n"; +#endif + // Clear logging files at the start of each simulation fstream("Output/Debug/logging.txt", ios::out | ios::trunc); fstream("Output/Debug/vertices.txt", ios::out | ios::trunc);