UFC crash - possible swig problem with intel compiler?

Asked by Chris Richardson

I have been building from source on a linux platform with the Intel compilers, icc and icpc using Intel MPI and Intel Blas implementation MKL. The reason for this, is that they are the recommended compilers for the system I am using.

I have compiled successfully, and the dolfin demos work with c++. When I try the python demos, I get the following (see below).
It seems to be related to a line in the UFC, compiled by swig:

  if (!PyArg_ParseTuple(args,(char *)"O:form_rank",&obj0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ufc__form, 0 | 0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "form_rank" "', argument " "1"" of type '" "ufc::form const *""'");
  }

So, SWIG_ConvertPtr is failing for some reason here... any ideas?

$ python demo_poisson.py
*** Warning: No module named viper
*** Warning: Unable to import Viper, plotting disabled.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "demo_poisson.py", line 61, in <module>
    solve(a == L, u, bc)
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 250, in solve
    _solve_varproblem(*args, **kwargs)
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 274, in _solve_varproblem
    form_compiler_parameters=form_compiler_parameters)
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 79, in __init__
    L = Form(L, form_compiler_parameters=form_compiler_parameters)
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/form.py", line 74, in __init__
    function_spaces)
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/form.py", line 108, in _extract_function_spaces
    r = compiled_form.rank()
  File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/ufc/ufc.py", line 261, in rank
    def rank(self): return _ufc.form_rank(self)
TypeError: in method 'form_rank', argument 1 of type 'ufc::form const *'

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Chris Richardson
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

This is a subtle and difficult problem to debug.

My first thought is to make sure that the JIT compiled forms are using
the ICC compiler and not something else.

Have you tried setting the CXX environment variable to icc?

If that was not set you should also run

   instant-clean

before you test it again.

Johan

On 06/14/2012 07:56 AM, Chris Richardson wrote:
> New question #200399 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/200399
>
> I have been building from source on a linux platform with the Intel compilers, icc and icpc using Intel MPI and Intel Blas implementation MKL. The reason for this, is that they are the recommended compilers for the system I am using.
>
> I have compiled successfully, and the dolfin demos work with c++. When I try the python demos, I get the following (see below).
> It seems to be related to a line in the UFC, compiled by swig:
>
> if (!PyArg_ParseTuple(args,(char *)"O:form_rank",&obj0)) SWIG_fail;
> res1 = SWIG_ConvertPtr(obj0,&argp1,SWIGTYPE_p_ufc__form, 0 | 0 );
> if (!SWIG_IsOK(res1)) {
> SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "form_rank" "', argument " "1"" of type '" "ufc::form const *""'");
> }
>
> So, SWIG_ConvertPtr is failing for some reason here... any ideas?
>
>
> $ python demo_poisson.py
> *** Warning: No module named viper
> *** Warning: Unable to import Viper, plotting disabled.
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
> Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> Traceback (most recent call last):
> File "demo_poisson.py", line 61, in<module>
> solve(a == L, u, bc)
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 250, in solve
> _solve_varproblem(*args, **kwargs)
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 274, in _solve_varproblem
> form_compiler_parameters=form_compiler_parameters)
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/solving.py", line 79, in __init__
> L = Form(L, form_compiler_parameters=form_compiler_parameters)
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/form.py", line 74, in __init__
> function_spaces)
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/dolfin/fem/form.py", line 108, in _extract_function_spaces
> r = compiled_form.rank()
> File "/home/cnr12/SandyBridge/FEniCS/lib64/python2.6/site-packages/ufc/ufc.py", line 261, in rank
> def rank(self): return _ufc.form_rank(self)
> TypeError: in method 'form_rank', argument 1 of type 'ufc::form const *'
>
>

Revision history for this message
Chris Richardson (chris-bpi) said :
#2

Yes, I can see this will not be easy to debug.

I am sure that it is using icc - I do have CC and CXX set.
I guess this might be more diagnostic:

$ cat ~/.instant/cache/instant_module_2035d927e55d586a0abd988820d662e2831cf68f/compile.log

ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053.h:39: Warning 520: Base class 'ufc::finite_element' of 'ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053_finite_element_0' is not similarly marked as a smart pointer.
ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053.h:394: Warning 520: Base class 'ufc::dofmap' of 'ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053_dofmap_0' is not similarly marked as a smart pointer.
ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053.h:654: Warning 520: Base class 'ufc::cell_integral' of 'ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053_cell_integral_0_0' is not similarly marked as a smart pointer.
ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053.h:726: Warning 520: Base class 'ufc::exterior_facet_integral' of 'ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053_exterior_facet_integral_0_0' is not similarly marked as a smart pointer.
ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053.h:834: Warning 520: Base class 'ufc::form' of 'ffc_form_645fcbaa5b7d558c250477ddfb91f44239805053_form_0' is not similarly marked as a smart pointer.
running build_ext
building '_instant_module_2035d927e55d586a0abd988820d662e2831cf68f' extension
creating build
creating build/temp.linux-x86_64-2.6
icc -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/cnr12/SandyBridge/FEniCS/include -I/home/cnr12/SandyBridge/FEniCS/include -I/usr/include/python2.6 -c instant_module_2035d927e55d586a0abd988820d662e2831cf68f_wrap.cxx -o build/temp.linux-x86_64-2.6/instant_module_2035d927e55d586a0abd988820d662e2831cf68f_wrap.o -O0
icc: command line warning #10006: ignoring unknown option '-fwrapv'
icc: command line warning #10006: ignoring unknown option '-fwrapv'
icc: command line warning #10120: overriding '-O2' with '-O0'
creating build/lib.linux-x86_64-2.6
icpc -pthread -shared build/temp.linux-x86_64-2.6/instant_module_2035d927e55d586a0abd988820d662e2831cf68f_wrap.o -L/home/cnr12/SandyBridge/FEniCS/lib -L/usr/lib64 -lboost_math_tr1-mt -lpython2.6 -o build/lib.linux-x86_64-2.6/_instant_module_2035d927e55d586a0abd988820d662e2831cf68f.so
running install
running build
running install_lib
copying build/lib.linux-x86_64-2.6/_instant_module_2035d927e55d586a0abd988820d662e2831cf68f.so -> .
running install_egg_info
Writing ./instant_module_2035d927e55d586a0abd988820d662e2831cf68f-0.0.0-py2.6.egg-info

Revision history for this message
Chris Richardson (chris-bpi) said :
#3

I branched back to revno:6724, and it now works.
Some recent change must have caused the problem here...