This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to use OpenMpAssembler in dolfin (C++)

+1 vote

Dear friends,

I am trying to use OpenMpAssembler function in dolfin 1.1.0 (C++). I have include header file:

include <dolfin/fem/OpenMpAssembler.h>

but when I use:
dolfin::OpenMpAssembler omp_assembler;
omp_assembler.assemble(A,a);

It gives out the following error:
error: ‘OpenMpAssembler’ is not a member of ‘dolfin’|

Did I miss something? Thanks.

XZ

asked Jul 10, 2013 by xzhao99 FEniCS Novice (270 points)

1 Answer

0 votes
 
Best answer

Your DOLFIN is probably compiled without OpenMP. Check by has_openmp() in python or by HAS_OPENMP C++ macro.

answered Jul 10, 2013 by Jan Blechta FEniCS Expert (51,420 points)
selected Jul 19, 2013 by Jan Blechta

Hi Jan,

Thank you for your answer. I am curious why dolfin use "HAS_OPENMP", I also find this macro in OpenMpAssembler.h file. When I make the test, I write

ifdef HAS_OPENMP

std::cout<<"openmp"<<std::endl;

endif

ifndef HAS_OPENMP

std::cout<<"NO openmp"<<std::endl;

endif

But it still shows "NO openmp" for the output. If I use #ifdef _OPENMP, it clearly shows that the openmp is compiled! Since OpenMpAssembler.h also uses HAS_OPENMP, I think this is the reason why OpenMpAssembler is not implemented!

Does DOLFIN define its own macro here? How can I compile FEniCS with OpenMP. During my installation, I just followed the standard instruction for Ubuntu.
Thank you very much.

XZ

How can I compile FEniCS with OpenMP.

You probably need to install FEniCS from source. I don't know whether precompiled binaries can work with OpenMP. Johannes would know but he is on holiday.

Yes, the precompiled binaries are compiled with OpenMP.

And, how I can to change the compiler in mac to get openmp fron the source?

...