Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2795c5ed authored by thierry's avatar thierry
Browse files

Add new test

parent ecc37042
No related branches found
No related tags found
No related merge requests found
find_package(OpenMP REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
add_executable(hello hello.c)
add_executable(hello-task hello-task.c)
add_executable(hello-task-gen hello-task-gen.cpp)
target_link_libraries(hello-task tikki m)
target_link_libraries(hello-task-gen tikki m)
#include <iostream>
#include <string>
#include <omp.h>
int array[] = { 1, 2, 3, 4};
/* Extern function: required binary to be link against libtikki.so
*/
extern "C" void ompt_set_task_name(const char* name );
class task_gen {
public:
task_gen( const std::string& name, int n )
: _name(name), _count(n) {}
void submit()
{
for (int i=0; i<_count; ++i)
{
ompt_set_task_name(_name.c_str());
#pragma omp task
{ std::cout << "In task " << i << "/" << _name << std::endl;
}
}
}
protected:
std::string _name;
int _count;
};
int main()
{
task_gen tg1("sub TaskGen1", 3);
task_gen tg2("sub TaskGen2", 3);
#pragma omp parallel
#pragma omp master
{
ompt_set_task_name("TaskGen1");
#pragma omp task
{
tg1.submit();
}
ompt_set_task_name("TaskGen2");
#pragma omp task
{
tg2.submit();
}
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment