Discussion:
[deal.II] openmp flag in CMake?
Kartik Jujare
2017-07-16 17:28:27 UTC
Permalink
Hello,

Would be grateful if anyone could correct or direct me to the right
solution.

As a test I have a following for loop is a step file

#pragma omp parallel
{
#pragma omp for //private(k) reduction(+:integral)
for (k = 0; k < 4; k++)
{
sleep(1);
}
}


Now the time outputs of the this for loop and another normal one (without
openmp) are the same. I think the problem lies in the flag that I am
passing in the Cmakefile but cant figure out what?

I have tried setting the following flags:

SET (MPI_CXX_COMPILE_FLAGS "-fopenmp")
//OR
SET (DEAL_II_CXX_FLAGS "-fopenmp")

I suppose I dont understand cmake very well. What would be an appropriate
place to place the above line in the CMakeLists.txt

Thank you and regards,
Kartik Jujare
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Maxi Miller' via deal.II User Group
2017-07-16 19:06:20 UTC
Permalink
Can you try CMake-GUI? At least there you can find all occurences of openmp
and enable it.
Post by Kartik Jujare
Hello,
Would be grateful if anyone could correct or direct me to the right
solution.
As a test I have a following for loop is a step file
#pragma omp parallel
{
#pragma omp for //private(k) reduction(+:integral)
for (k = 0; k < 4; k++)
{
sleep(1);
}
}
Now the time outputs of the this for loop and another normal one (without
openmp) are the same. I think the problem lies in the flag that I am
passing in the Cmakefile but cant figure out what?
SET (MPI_CXX_COMPILE_FLAGS "-fopenmp")
//OR
SET (DEAL_II_CXX_FLAGS "-fopenmp")
I suppose I dont understand cmake very well. What would be an appropriate
place to place the above line in the CMakeLists.txt
Thank you and regards,
Kartik Jujare
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kartik Jujare
2017-07-16 20:09:27 UTC
Permalink
Dear Maxi,

Thank you so much for reminding me of that !! Works fantastic!

Regards,
Kartik Jujare
Post by 'Maxi Miller' via deal.II User Group
Can you try CMake-GUI? At least there you can find all occurences of
openmp and enable it.
Post by Kartik Jujare
Hello,
Would be grateful if anyone could correct or direct me to the right
solution.
As a test I have a following for loop is a step file
#pragma omp parallel
{
#pragma omp for //private(k) reduction(+:integral)
for (k = 0; k < 4; k++)
{
sleep(1);
}
}
Now the time outputs of the this for loop and another normal one (without
openmp) are the same. I think the problem lies in the flag that I am
passing in the Cmakefile but cant figure out what?
SET (MPI_CXX_COMPILE_FLAGS "-fopenmp")
//OR
SET (DEAL_II_CXX_FLAGS "-fopenmp")
I suppose I dont understand cmake very well. What would be an appropriate
place to place the above line in the CMakeLists.txt
Thank you and regards,
Kartik Jujare
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jean-Paul Pelteret
2017-07-16 20:12:55 UTC
Permalink
Dear Kartik,

There's both a section in the main
<https://www.dealii.org/developer/users/cmake.html#compiler> and
user-project
<https://www.dealii.org/developer/users/cmakelists.html#cmakeadvanced.setup_target>
documentation on CMake about how to configure CMake with extra compile and
linker flags. Take a look there, and perhaps the information contained
therein will help clear things up. I think that you need to extend `
DEAL_II_CXX_FLAGS` or `DEAL_II_LINKER_FLAGS` with this extra flag after
DEAL_II_INITIALIZE_CACHED_VARIABLES but before calling DEAL_II_INVOKE_AUTOPILOT
or DEAL_II_SETUP_TARGET.

I hope that this helps.
Regards,
Jean-Paul
Post by Kartik Jujare
Hello,
Would be grateful if anyone could correct or direct me to the right
solution.
As a test I have a following for loop is a step file
#pragma omp parallel
{
#pragma omp for //private(k) reduction(+:integral)
for (k = 0; k < 4; k++)
{
sleep(1);
}
}
Now the time outputs of the this for loop and another normal one (without
openmp) are the same. I think the problem lies in the flag that I am
passing in the Cmakefile but cant figure out what?
SET (MPI_CXX_COMPILE_FLAGS "-fopenmp")
//OR
SET (DEAL_II_CXX_FLAGS "-fopenmp")
I suppose I dont understand cmake very well. What would be an appropriate
place to place the above line in the CMakeLists.txt
Thank you and regards,
Kartik Jujare
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kartik Jujare
2017-07-16 20:58:59 UTC
Permalink
Dear Jean,

Thank you for pointing that out. I somehow missed the the 3.7 section while
browsing through it.

Regards,
Kartik Jujare
Post by Jean-Paul Pelteret
Dear Kartik,
There's both a section in the main
<https://www.dealii.org/developer/users/cmake.html#compiler> and
user-project
<https://www.dealii.org/developer/users/cmakelists.html#cmakeadvanced.setup_target>
documentation on CMake about how to configure CMake with extra compile and
linker flags. Take a look there, and perhaps the information contained
therein will help clear things up. I think that you need to extend `
DEAL_II_CXX_FLAGS` or `DEAL_II_LINKER_FLAGS` with this extra flag after
DEAL_II_INITIALIZE_CACHED_VARIABLES but before calling DEAL_II_INVOKE_AUTOPILOT
or DEAL_II_SETUP_TARGET.
I hope that this helps.
Regards,
Jean-Paul
Post by Kartik Jujare
Hello,
Would be grateful if anyone could correct or direct me to the right
solution.
As a test I have a following for loop is a step file
#pragma omp parallel
{
#pragma omp for //private(k) reduction(+:integral)
for (k = 0; k < 4; k++)
{
sleep(1);
}
}
Now the time outputs of the this for loop and another normal one (without
openmp) are the same. I think the problem lies in the flag that I am
passing in the Cmakefile but cant figure out what?
SET (MPI_CXX_COMPILE_FLAGS "-fopenmp")
//OR
SET (DEAL_II_CXX_FLAGS "-fopenmp")
I suppose I dont understand cmake very well. What would be an appropriate
place to place the above line in the CMakeLists.txt
Thank you and regards,
Kartik Jujare
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...