File
// Copyright (c) 2018 Gabriel Laberge
// Copyright (c) 2017 Zahra Khatami
// Copyright (c) 2016 David Pfander
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <cstdlib>
#include <ctime>
#include <vector>
#include <fstream>
#include <string>
#include <initializer_list>
#include <algorithm>
#include <typeinfo>
#include <iterator>
#include <map>
#include <hpx/hpx_init.hpp>
#include <hpx/parallel/algorithms/for_each.hpp>
#include <hpx/util/high_resolution_timer.hpp>
////put in header/////
#include <hpx/parallel/executors/dynamic_chunk_size.hpp>
#include "algorithms/dynamic_and_times/1_loop_level.h"
#include "algorithms/dynamic_and_times/2_loop_level.h"
#include "algorithms/dynamic_and_times/3_loop_level.h"
#include "algorithms/dynamic_and_times/4_loop_level.h"
void Fill_map(std::map<std::string, void (*)(int, std::vector<double>, bool)>& OPTIONS) {
OPTIONS.insert( std::make_pair("Nothing", Nothing) );
OPTIONS.insert( std::make_pair("Swao", Swap) );
OPTIONS.insert( std::make_pair("Stream", Stream) );
OPTIONS.insert( std::make_pair("Stencil", Stencil) );
OPTIONS.insert( std::make_pair("Matrix_Vector_Mult", Matrix_Vector_Mult) );
OPTIONS.insert( std::make_pair("Diadic_Prod", Diadic_Prod) );
OPTIONS.insert( std::make_pair("Cosine", Cosine) );
OPTIONS.insert( std::make_pair("Matrix_Matrix_Mult", Matrix_Matrix_Mult) );
OPTIONS.insert( std::make_pair("Max", Max) );
OPTIONS.insert( std::make_pair("Tensor_generator", Tensor_generator) );
}
//////////////////////////
//
//
int hpx_main(int argc, char* argv[])
{
// Initialization
//
std::map<std::string, void (*)(int, std::vector<double>, bool)> OPTIONS;
int iterations=strtol(argv[2], NULL, 10);
std::vector<double> chunk_candidates(5);
chunk_candidates[0] = 0.5; chunk_candidates[1] = 0.125; chunk_candidates[2] = 0.03125;
chunk_candidates[3] = 0.0078125; chunk_candidates[4] = 0.001953125;
Fill_map(OPTIONS);
auto function=OPTIONS.find(argv[1]);
if(function != OPTIONS.end()) {
(*function)(iterations, chunk_candidates, true);
}
else{ std::cout<< "Function not found" <<std::endl;}
return hpx::finalize();
}
int main(int argc, char* argv[])
{
return hpx::init(argc, argv);
}
error message /home/glaberge/hpxML/Training_data/main.cpp:61:9: error: type 'std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string, void ()(int, std::__1::vector<double, std::__1::allocator >, bool)>, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string, void ()(int, std::__1::vector<double, std::__1::allocator >, bool)>, void *> , long> >::value_type' (aka 'pair<const std::__1::basic_string, void ()(int, std::__1::vector<double, std::__1::allocator >, bool)>') does not provide a call operator (*function)(iterations, chunk_candidates, true); ^~~~~~~~~~~ 1 error generated. make[2]: *** [CMakeFiles/data_exe.dir/main.cpp.o] Error 1 make[1]: *** [CMakeFiles/data_exe.dir/all] Error 2