[pythran] Compile error

  • From: Matthieu Haefele <matthieu.haefele@xxxxxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Tue, 16 Mar 2021 21:38:20 +0100

Dear all,

I am new to pythran. I have a very non optimised computing kernel written by a 
mathematician I am giving support to. Instead of
introducing numpy routines as I am used to, I wanted to give it a try with 
pythran. The code is attached and I get a compile error
after a couple of seconds with the compiler taking more than 1.5GB of RAM when 
I issue the simple command:

pythran compute_module.py
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
WARNING: Compilation error, trying hard to find its origin...
WARNING: Nop, I'm going to flood you with C++ errors!
CRITICAL: Cover me Jack. Jack? Jaaaaack!!!!
E: error: Command "x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall 
-g -fstack-protector-strong -Wformat
-Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC 
-DENABLE_PYTHON_MODULE -D__PYTHRAN__=3 -DPYTHRAN_BLAS_BLAS
-I/usr/local/lib/python3.6/dist-packages/pythran 
-I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/local/include
-I/usr/include -I/usr/include/python3.6m -c /tmp/tmpjtua4ztv.cpp -o 
/tmp/tmp06sjide7/tmp/tmpjtua4ztv.o -std=c++11 -fno-math-errno
-w -fvisibility=hidden -fno-wrapv" failed with exit status 4

g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 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.

Am I doing something wrong here ?

Thanks for your help
Best,
Mat

-- 
Dr. Matthieu Haefele

Laboratoire de Mathématiques et de leurs Applications de Pau (France)
Tel: +33 (0)5 59 40 75 27 


# Schema numerique : 
#     $$U^{n+1}_i = U^{n}_i - 
\underbrace{\frac{dt}{dx}}_{:=\lambda}\Big[H(U^{n}_i,U^{n}_{i+1})-H(U^{n}_{i-1},U^{n}_i)\Big]
 + dB\ h(U^{n}_i) - \frac{dt}{dx} \Big[\sum_{|j| < K} \widetilde G_{j-i} 
A(U^n_{j}) - \frac12 A(U^n_{-K}) \sum_{|j|< K+i} \widetilde G_j- \frac12 
A(U^n_{K})\sum_{|j| < K-i} \widetilde G_j\Big]$$

# Godounov : 
# $$H(u,v)=\min_{[u,v]}f 1_{u<v} + \max_{[u,v]}f 1_{u\geq v}$$

# Lax-Friedrichs
# $$H(u,v)= \frac12\Big[f(u)+f(v)-\|f'\|_{\infty}(v-u) \Big]$$

# Roe Scheme
# $$H(u,v)= f(u)1_{\frac{f(v)-f(u)}{v-u}>0} + f(v)1_{\frac{f(v)-f(u)}{v-u}\leq 
0}$$

# Engquist-Osher
# $$H(u,v)=f(0)+\int_0^{u}[f^\prime]^+(s)ds - \int_0^{v}[f^\prime]^-(s)ds $$

def H(u,v):

# Godounov
#    B=min( f(max(1,v)) , max( f(max(0,u)) ,f(min(v,0)) ) )/f(max(1,u))
#    C=B + (1-f(max(1,u)))*(1-f(max(1,v)))*(f(v)-B)
#    C=f(u) # cas particulier de valeurs entre 0 et 1
    C=max( f(min(0,v)) , f(max(0,u) ))
# on doit avoir min( f(max(1,v)), max(f(-v^-),f(min(u^+,1))) )

# Lax-Friedrichs
#    C= 0.5*(f(u)+f(v)-2.08*(v-u))

# Roe Scheme
#    C=f(v)
#    if v!=u and (f(v)-f(u))/(v-u)>0:
#        C=f(u)

# Engquist-Osher
#    C=f(min(1,max(0,u))) + f(v) - f(min(1,max(0,v)))
    return C;


# fonction dans l'operateur nonlocal
def A(v):
    #return max(0,v);
    return v;

# fonction dans le bruit
def h(v):
    #return max(0,v*(1-v));
    return 0;

# flux
def f(v):
    return v**2/2;

#pythran export compute(float64[][], float64[][], float64[][], float64[], 
float64[], float64[], float, int, int, int, float)
def compute(U, SORTIE, V, G, Gsomme, dW, dt, nbrT, m, M, Lambda):
    #nb_iter = nbrT-1
    nb_iter = 10
    for n in range(nb_iter):
        U[n+1,0]=U[n,0]     # =ubordGauche pour Dirichlet
        U[n+1,M-1]=U[n,M-1] # =ubordDroite pour Dirichlet
        for i in range(1,M-1):
            u1=U[n,i]
            v1=U[n,i+1]
            w1=U[n,i-1]
            NonLocal=-0.5*A(U[n,0])*Gsomme[i]-0.5*A(U[n,M-1])*Gsomme[2*m-i]
            for j in range(1,M-1):
                NonLocal=NonLocal + G[j-i+M-1]*A(U[n,j])       #+ 
G[j-i+M-1]*(A(U[n,j])-A(U[n,i]))   #

            u2=u1-Lambda*(H(u1,v1)-H(w1,u1)) + dW[n]*h(u1) - dt*NonLocal
            U[n+1,i]=u2
        print(n,' sur ',nbrT-1)

Attachment: smime.p7s
Description: Signature cryptographique S/MIME

Other related posts: