I'm using python 3 and recently I was able to interface a FORTRAN solver for some type of optimization problems (thanks to eryksun here on stack overflow).
The little issue that is getting on the way is that the solver output in the python notebook (jupyter) does not show up. Note that the solver returns the right solution, but it doesn't display its progress nor any mesages. Although, if call the same FORTRAN solver from a julia notebook, I can see the output in the julia notebook. The solver output/message is just the FORTRAN write() statements to stdout.
For instance, this is what julia notebook shows:
Hello World from Wrapper!
Iter: 0 Nfun: 1 f1(x) = 24.20000 Eps = 116.4338
Iter: 1 Nfun: 2 f1(x) = 24.20000 Eps = 48.68118
Iter: 2 Nfun: 3 f1(x) = 6.307350 Eps = 7.505725
Iter: 3 Nfun: 4 f1(x) = 6.307350 Eps = 4.854666
Iter: 4 Nfun: 5 f1(x) = 3.580435 Eps = 0.1099409
Iter: 5 Nfun: 6 f1(x) = 3.580435 Eps = 0.8368376E-01
.....
The solver takes as a parameter the desired fileout number. For FORTRAN this is 6 for stdout. When I call the solver from python and julia I set this parameter to 6.
It seems it has to do with the kernel (python vs. julia) in jupyter but I'm not able to find a simple straight forward way to see this output which is crucial for debugging and validation purposes.
Any hints or suggestions?
Thank you in advance!
Followup: here is the code that calls the FORTRAN solver - it has 31 parameters. Parameter num_outcalls (set to 6) and disp (set to 3 for verbose mode). FORTRAN is the loaded fortran library "solver_lib.so"
retval = FORTRAN.c_mpbngc(OptProb.dim.ctypes._as_parameter_, \
OptProb.X.ctypes._as_parameter_, \
OptProb.Tx.ctypes._as_parameter_, \
OptProb.Blox.ctypes._as_parameter_, \
OptProb.Bupx.ctypes._as_parameter_, \
OptProb.num_objfunc.ctypes._as_parameter_, \
ct.byref(ct.c_int(OptProb.num_genconstr)), \
ct.byref(ct.c_int(OptProb.num_linconstr)), \
OptProb.Tlinconstr.ctypes._as_parameter_, \
OptProb.Blo_linconstr.ctypes._as_parameter_, \
OptProb.Bup_linconstr.ctypes._as_parameter_, \
OptProb.CClinconstr.ctypes._as_parameter_, \
OptProb.F.ctypes._as_parameter_, \
OptProb.ptrfuncFASGTYPE(OptProb.ptrObjFunc), \
ct.byref(ct.c_double(OptProb.r_linsear)), \
ct.byref(ct.c_int(OptProb.max_numcallsobjfun_linsear)),\
OptProb.Gam.ctypes._as_parameter_, \
ct.byref(ct.c_double(OptProb.tol)), \
ct.byref(ct.c_double(OptProb.tol_constrfeas)), \
ct.byref(ct.c_int(OptProb.max_numsubgrads)), \
OptProb.num_iters.ctypes._as_parameter_, \
OptProb.max_numcallsobjfun.ctypes._as_parameter_, \
OptProb.num_outcalls.ctypes._as_parameter_, \
OptProb.disp.ctypes._as_parameter_, \
OptProb.err_type.ctypes._as_parameter_, \
OptProb.IWORK.ctypes._as_parameter_, \
ct.byref(ct.c_int(OptProb.LIWORK)), \
OptProb.WORK.ctypes._as_parameter_, \
ct.byref(ct.c_int(OptProb.LWORK)), \
OptProb.ptrfuncFASGTYPE(OptProb.ptrObjFunc), \
OptProb.USER.ctypes._as_parameter_)