Optimized Belief Propagation (CPU and GPU)
DriverCudaBp.cpp
Go to the documentation of this file.
1 /*
2 Copyright (C) 2024 Scott Grauer-Gray
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
35 
48 int main(int argc, char** argv)
49 {
50  //initialize run implementation settings
51  run_environment::RunImpSettings run_imp_settings;
52 
53  //set datatype(s) to use in run processing in evaluation
54  run_imp_settings.datatypes_eval_sizes =
57 
58  //set whether or not to run and evaluate alternate optimized implementations
59  //in addition to the "fastest" optimized implementation available
61 
62  //set setting of whether or not to use templated loop iterations in implementation
63  //in evaluation runs
64  run_imp_settings.templated_iters_setting =
66 
67  //enable optimization of parallel parameters with setting to use the allow different thread block dimensions
68  //on kernels in same run
69  //testing on has found that using different parallel parameters (corresponding to thread block dimensions)
70  //in different kernels in the optimized CUDA implementation can decrease runtime
71  run_imp_settings.opt_parallel_params_setting =
73 
74  //set default parallel parameters and parallel parameters to benchmark when searching for optimal
75  //parallel parameters
76  run_imp_settings.p_params_default_alt_options =
79 
80  //set path of baseline runtimes and baseline description
81  run_imp_settings.baseline_runtimes_path_desc =
84 
85  //set data subsets to evaluate separate from all data
87 
88  //set run name to first argument if it exists
89  //otherwise set to "CurrentRun"
90  run_imp_settings.run_name = (argc > 1) ? argv[1] : "CurrentRun";
91 
92  //run and evaluate benchmark with multiple inputs and configurations using CUDA acceleration
93  RunImpMultTypesAccels().operator()(
94  {{std::make_shared<RunImpMultInputsBp>(run_environment::AccSetting::kCUDA)}},
95  run_imp_settings,
96  std::make_unique<EvaluateImpResultsBp>());
97 
98  return 0;
99 }
Belief propagation implementation constants related to file processing.
Declares structure to store the belief propagation settings including the number of levels and iterat...
int main(int argc, char **argv)
Main() function that drives the optimized CPU belief propgation implementation evaluation across mult...
Declares child class of EvaluateImpResults that defines member functions for belief propagation evalu...
Contains namespace with constants and functions to get CUDA device properties as well as default and ...
Declares child class of RunImpMultInputs to run specified belief propagation implementation on a numb...
Declares class to run and evaluate implementation(s) of an algorithm using multiple settings includin...
Class to run and evaluate implementation(s) of an algorithm using multiple settings including differe...
constexpr std::string_view kBaselineRunDesc
constexpr std::string_view kBaselineRunDataPath
const std::vector< std::pair< std::string, std::vector< InputSignature > > > kEvalDataSubsets
Define subsets for evaluating run results on specified inputs The first three stereo sets are labele...
constexpr std::array< unsigned int, 2 > kParallelParamsDefault
Default thread block dimensions (which is what parallel parameters corresponds to in CUDA implementat...
const std::set< std::array< unsigned int, 2 > > kParallelParameterAltOptions
Parallel parameter alternative options to run to retrieve optimized parallel parameters in CUDA imple...
constexpr run_environment::TemplatedItersSetting kTemplatedItersEvalSettings
constexpr bool kRunAltOptimizedImps
constexpr std::array< size_t, 3 > kDataTypesEvalSizes
Structure that stores settings for current implementation run.
Definition: RunSettings.h:84
TemplatedItersSetting templated_iters_setting
Definition: RunSettings.h:86
std::optional< std::array< std::string_view, 2 > > baseline_runtimes_path_desc
Definition: RunSettings.h:93
std::vector< unsigned int > datatypes_eval_sizes
Definition: RunSettings.h:85
std::pair< std::array< unsigned int, 2 >, std::set< std::array< unsigned int, 2 > > > p_params_default_alt_options
Definition: RunSettings.h:89
OptParallelParamsSetting opt_parallel_params_setting
Definition: RunSettings.h:87
std::vector< std::pair< std::string, std::vector< InputSignature > > > subset_desc_input_sig
Definition: RunSettings.h:95