Skip to content

Feature Extraction Using ClangTool

galabc edited this page Nov 28, 2018 · 1 revision

The loop convert executable can be used in two ways

Data Generation Mode

In this mode, the executable will print features in the console which is usefull to make a dataset. To print out features, the boolean parameter -P must be put to TRUE.

path/to/cfe-6.0.0.src/build/bin/loop-convert main.cpp -P=TRUE -- -Iinclude path/to/hpx path/to/Boost

This will output the static in the console which is useful when you want to generate data.

Loop Conversion Mode

In this mode, the executable will convert HPX for-each loops that contains the execution policies par_if,adaptive_chunk_size,make_prefetcher_policy. To convert a loop, the parameter -C must be set to TRUE.

path/to/cfe-6.0.0.src/build/bin/loop-convert main.cpp -C=TRUE -- -Iinclude path/to/hpx path/to/Boost

when using this command on a main.cpp that contains some of these loops

hpx::parallel::for_each(hpx::parallel::par_if, time_range.begin(), time_range.end(), f);

hpx::parallel::for_each(hpx::parallel::par.with(hpx::parallel::adaptive_chunk_size()), time_range.begin(), time_range.end(), f);	

hpx::parallel::for_each(hpx::parallel::execution::make_prefetcher_policy(policy, prefetching_distance_factor, ...), time_range.begin(), time_range.end(), f);

These will be changed to:

hpx::parallel::for_each(hpx::parallel::par, time_range.begin(), time_range.end(), f);

hpx::parallel::for_each(hpx::parallel::par.with(hpx::parallel::chunk_size_determination(EXTRACTED_STATICE_DYNAMIC_FEATURES)), time_range.begin(), time_range.end(), f);	

hpx::parallel::for_each(hpx::parallel::execution::make_prefetcher_policy(policy, hpx::parallel::prefetching_distance_determination(EXTRACTED_STATICE_DYNAMIC_FEATURES), ...), time_range.begin(), time_range.end(), f);

#Note the execution policies par_if, adaptive_chunk_size() and make_prefetcher_policy() are not defined and therefore the compiler will bring an error unless they are defined as empty structures

For example

namespace hpx { namespace parallel { struct adaptive_chunk_size {};}}