Pragma error while running test cases

I’m trying to run the viscous shock tube test case and the double Mach reflection case.

I’m getting the following error, please help me resolve this

:~/PyFR-Test-Cases/2d-viscous-shock-tube$ pyfr import viscous-shock-tube.msh viscous-shock-tube.pyfrm
:~/PyFR-Test-Cases/2d-viscous-shock-tube$ ls
viscous-shock-tube.ini  viscous-shock-tube.msh  viscous-shock-tube.msh.xz  viscous-shock-tube.pyfrm
:~/PyFR-Test-Cases/2d-viscous-shock-tube$ pyfr run -b openmp viscous-shock-tube.pyfrm viscous-shock-tube.ini
Traceback (most recent call last):
  File "/usr/local/bin/pyfr", line 33, in <module>
    sys.exit(load_entry_point('pyfr==1.15.0', 'console_scripts', 'pyfr')())
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 125, in main
    args.process(args)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 272, in process_run
    _process_common(
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 257, in _process_common
    solver = get_solver(backend, rallocs, mesh, soln, cfg)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/__init__.py", line 14, in get_solver
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/__init__.py", line 34, in get_integrator
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/std/controllers.py", line 11, in __init__
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/std/base.py", line 26, in __init__
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/base/system.py", line 67, in commit
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/base/system.py", line 213, in _gen_kernels
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/navstokes/inters.py", line 106, in <lambda>
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/base/backend.py", line 174, in kernel
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/base/kernels.py", line 157, in kernel_meth
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/provider.py", line 73, in _build_kernel
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/util.py", line 39, in newmeth
    res = cache[key] = meth(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/provider.py", line 65, in _build_library
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/compiler.py", line 58, in build
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 226, in call_capture_output
    return forker.call_capture_output(cmdline, cwd, error_on_nonzero)
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 182, in call_capture_output
    return self._remote_invoke("call_capture_output", cmdline, cwd,
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 164, in _remote_invoke
    raise result
pytools.prefork.ExecError: error invoking 'cc -shared -std=c99 -Ofast -march=native -fopenmp -fPIC -o libtmp.so tmp.c -lm': status 1 invoking 'cc -shared -std=c99 -Ofast -march=native -fopenmp -fPIC -o libtmp.so tmp.c -lm': tmp.c: In function ‘bccent’:
tmp.c:17:39: error: expected ‘read’, ‘write’, ‘update’, ‘capture’, ‘seq_cst’, ‘acq_rel’, ‘release’, ‘relaxed’ or ‘hint’ clause
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:80:1: note: in expansion of macro ‘atomic_min_fpdtype’
   80 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected end of line before ‘compare’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:80:1: note: in expansion of macro ‘atomic_min_fpdtype’
   80 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:69: error: expected expression before ‘if’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                                                     ^~
tmp.c:80:1: note: in expansion of macro ‘atomic_min_fpdtype’
   80 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected ‘read’, ‘write’, ‘update’, ‘capture’, ‘seq_cst’, ‘acq_rel’, ‘release’, ‘relaxed’ or ‘hint’ clause
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:125:1: note: in expansion of macro ‘atomic_min_fpdtype’
  125 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected end of line before ‘compare’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:125:1: note: in expansion of macro ‘atomic_min_fpdtype’
  125 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:69: error: expected expression before ‘if’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                                                     ^~
tmp.c:125:1: note: in expansion of macro ‘atomic_min_fpdtype’
  125 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~

PyFR requires GCC >= 12.0 or another C compiler with OpenMP 5.1 support. Do you meet this?

Yeah Im running GCC 12.2, please help me resolve this

If you were running GCC 12 you would not be getting this error. Please check exactly what compiler PyFR is using.

Regards, Freddie.

Please help me to resolve this, I’m using GCC 12.2.0

I am not able to move forward in research work

:~/PyFR-Test-Cases/2d-viscous-shock-tube$ pyfr run -b openmp viscous-shock-tube.pyfrm viscous-shock-tube.ini
Traceback (most recent call last):
  File "/usr/local/bin/pyfr", line 33, in <module>
    sys.exit(load_entry_point('pyfr==1.15.0', 'console_scripts', 'pyfr')())
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 125, in main
    args.process(args)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 272, in process_run
    _process_common(
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/__main__.py", line 257, in _process_common
    solver = get_solver(backend, rallocs, mesh, soln, cfg)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/__init__.py", line 14, in get_solver
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/__init__.py", line 34, in get_integrator
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/std/controllers.py", line 11, in __init__
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/integrators/std/base.py", line 26, in __init__
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/base/system.py", line 67, in commit
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/base/system.py", line 213, in _gen_kernels
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/solvers/navstokes/inters.py", line 106, in <lambda>
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/base/backend.py", line 174, in kernel
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/base/kernels.py", line 157, in kernel_meth
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/provider.py", line 73, in _build_kernel
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/util.py", line 39, in newmeth
    res = cache[key] = meth(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/provider.py", line 65, in _build_library
  File "/usr/local/lib/python3.10/dist-packages/pyfr-1.15.0-py3.10.egg/pyfr/backends/openmp/compiler.py", line 58, in build
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 226, in call_capture_output
    return forker.call_capture_output(cmdline, cwd, error_on_nonzero)
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 182, in call_capture_output
    return self._remote_invoke("call_capture_output", cmdline, cwd,
  File "/usr/lib/python3/dist-packages/pytools/prefork.py", line 164, in _remote_invoke
    raise result
pytools.prefork.ExecError: error invoking 'cc -shared -std=c99 -Ofast -march=native -fopenmp -fPIC -o libtmp.so tmp.c -lm': status 1 invoking 'cc -shared -std=c99 -Ofast -march=native -fopenmp -fPIC -o libtmp.so tmp.c -lm': tmp.c: In function ‘bccent’:
tmp.c:17:39: error: expected ‘read’, ‘write’, ‘update’, ‘capture’, ‘seq_cst’, ‘acq_rel’, ‘release’, ‘relaxed’ or ‘hint’ clause
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:81:1: note: in expansion of macro ‘atomic_min_fpdtype’
   81 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected end of line before ‘compare’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:81:1: note: in expansion of macro ‘atomic_min_fpdtype’
   81 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:69: error: expected expression before ‘if’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                                                     ^~
tmp.c:81:1: note: in expansion of macro ‘atomic_min_fpdtype’
   81 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected ‘read’, ‘write’, ‘update’, ‘capture’, ‘seq_cst’, ‘acq_rel’, ‘release’, ‘relaxed’ or ‘hint’ clause
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:127:1: note: in expansion of macro ‘atomic_min_fpdtype’
  127 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:39: error: expected end of line before ‘compare’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                       ^~~~~~~
tmp.c:127:1: note: in expansion of macro ‘atomic_min_fpdtype’
  127 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
tmp.c:17:69: error: expected expression before ‘if’
   17 | #define atomic_min_fpdtype(addr, val) _Pragma("omp atomic compare") if ((val) < *(addr)) { *(addr) = (val); }
      |                                                                     ^~
tmp.c:127:1: note: in expansion of macro ‘atomic_min_fpdtype’
  127 | atomic_min_fpdtype(&entmin_lhs_v[entmin_lhs_vix[BLK_IDX + X_IDX]], entmin_lhs);
      | ^~~~~~~~~~~~~~~~~~
:~/PyFR-Test-Cases/2d-viscous-shock-tube$ which gcc
/usr/local/bin/gcc
:~/PyFR-Test-Cases/2d-viscous-shock-tube$ gcc --version
gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
111

What does cc --version give, as this is the compiler PyFR will try and use by default.

Regards, Freddie.

~/PyFR-Test-Cases/2d-viscous-shock-tube$ cc --version
cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.

As I noted above, you are using an old version of GCC.

Regards, Freddie.

1 Like