Comments (4)
Hi @Z10Frank,
I think in this case you can use #pragma oss task for
as described here
https://pm.bsc.es/ftp/ompss-2/doc/spec/directives/index.html#task-for-clause
Let me know if this is useful.
Kind regards,
from mcxx.
Hello,
thank you for your answer, I know the #pragma oss task for
construct, but my purpose was rather to understand the compatibility with OpenMP itself.
The objective is to progressively "taskify" a load imbalanced part of an existing code that already uses OpenMP, in particular with parallel
regions, omp for
, omp simd
. So a preliminary question is if the use of OmpSs-2 in this code would imply the substitution of all existing OpenMP pragmas with "equivalents" in OmpSs-2. Or if there is a way to switch between OpenMP and OmpSs-2 pragmas with an if condition.
from mcxx.
The objective is to progressively "taskify" a load imbalanced part of an existing code that already uses OpenMP, in particular with
parallel
regions,omp for
,omp simd
. So a preliminary question is if the use of OmpSs-2 in this code would imply the substitution of all existing OpenMP pragmas with "equivalents" in OmpSs-2.
The OmpSs-2 compatibility with OpenMP is limited. It may happen that some constructs will require you to substitute/temporarily disable the unsupported OpenMP constructs.
Or if there is a way to switch between OpenMP and OmpSs-2 pragmas with an if condition.
Not sure what you mean by "if" condition here, one option is using the macro _OMPSS_2
so you can enable OpenMP or OmpSs-2 progressively in your code. This macro is enabled when you use --ompss-2
with Mercurium.
#if _OMPSS_2
#pragma oss task ...
#else
#pragma omp ...
#endif
Hope this helps.
from mcxx.
Thank you!
To keep it in the archives, my test after the modifications:
#include <stdio.h>
#include <iostream>
#include <omp.h>
using namespace std;
int main(int argc, char *argv[])
{
#ifndef _OMPSS_2
#pragma omp parallel
#endif
{
#ifndef _OMPSS_2
//with OpenMP
#pragma omp for
for (int i=0; i<10; i++)
{
#pragma omp critical
cout<<"Hello omp for from thread "<<omp_get_thread_num()<<" iteration "<<i<<"\n"<<endl;
}
#else
// with OmpSs-2
for (int i=0; i<10; i++)
{
#pragma oss task firstprivate(i)
{
#pragma oss critical
{
cout<<"Hello OmpSs-2/, iteration "<<i<<endl;
}
}
}
#endif
} // end parallel region if OpenMP is used
return 0;
}
To compile with OpenMP:
mpiicpc -o test_OpenMP -fopenmp test_OpenMP_OmpSs-2.cpp
To compile with OmpSs-2:
I_MPI_CXX=mcxx MPICH_CXX=mcxx OMPI_CXX=mcxx mpiicpc -o test_OmpSs-2 --ompss-2 test_OpenMP_OmpSs-2.cpp
from mcxx.
Related Issues (17)
- mfc compiler error HOT 1
- mfc kind statement error HOT 1
- mfc error with a constructor
- mfc does not support type bound procedures
- mfc class and self not supported
- mfc error with public enumerated types HOT 1
- mfc extend not supported?
- mfc select type is not supported
- missing libiconv HOT 1
- `error: ‘ICONV_CONST’ undeclared`, maybe a bug in the code? HOT 1
- undefined reference to `Codegen::FortranBase::codegen_type HOT 2
- Compilation with Nanos6 for OmpSs-2 HOT 8
- Compilation with make and dependency files HOT 20
- No rule to make target 'src/frontend/cxx-asttype.def', needed by 'src/frontend/cxx-asttype.c'. Stop. HOT 11
- test failures
- TARGET statement is not handling array-spec correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcxx.