Closed gassbrock closed 6 years ago
What version of gfortran are you using? I've never tried to compile it with gfortran on Windows. It does compile and run fine on a Mac. It also works fine on Windows with the intel compiler.
Can you compile with all debugging and run time checks enabled to see if there is a more descriptive error message?
The warnings are not a problem.
Dear @jacobwilliams, thanks for your quick reply. I am using gfortran 4.8.0. I added
all debugging and run time checks
to my compiler call I could found here gcc.gnu.org summarized to %OPT_DEBUG%
which looks like this:
-Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow,invalid -finit-real=nan -pedantic -Warray-temporaries -Wcharacter-truncation -Wline-truncation -Wconversion-extra -Wimplicit-interface -Wimplicit-procedure -Wintrinsics-std -Wreal-q-constant -Wsurprising -Wunderflow -Walign-commons -Wfunction-elimination -Wrealloc-lhs -Wrealloc-lhs-all
Other compiler options %OPT_COMP%
like mentioned in your shell script still included
-c -O2 -std=f2008
No I face still only warnings; did I miss significant options to show errors?
gfortran %OPT_COMP% %OPT_DEBUG% slsqp_support.f90
returns:
..\src\slsqp_support.f90:246.17:
if ( x(ix)/=zero ) then
1
Warning: Inequality comparison for REAL(8) at (1)
..\src\slsqp_support.f90:45.9:
if ( da==zero ) return
1
Warning: Equality comparison for REAL(8) at (1)
gfortran %OPT_COMP% %OPT_DEBUG% slsqp_core.f90
returns
..\src\slsqp_core.f90:2028.28:
if ( fu<=fw .or. w==x ) then
1
Warning: Equality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:2033.43:
else if ( fu<=fv .or. v==x .or. v==w ) then
1
Warning: Equality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:2033.33:
else if ( fu<=fv .or. v==x .or. v==w ) then
1
Warning: Equality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:1907.9:
if ( sigma/=zero ) then
1
Warning: Inequality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:1855.13:
if ( b/=zero ) then
1
Warning: Inequality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:1797.21:
if ( sm/=0 ) then
1
Warning: Inequality comparison for REAL(8) at (1)
..\src\slsqp_core.f90:1583.52:
if ( diff(hmax+factor*h(lmax),hmax)>0 ) need_lmax = .false.
1
Warning: Conversion from INTEGER(4) to REAL(8) at (1)
..\src\slsqp_core.f90:1590.27:
h(l) = 0.
1
Warning: Conversion from REAL(4) to REAL(8) at (1)
..\src\slsqp_core.f90:1437.9:
if ( alpha==two ) then
1
Warning: Equality comparison for REAL(8) at (1)
..\src\slsqp_core.f90: In function 'lsi':
..\src\slsqp_core.f90:1295:0: warning: 'izmax' may be used uninitialized in this function [-Wmaybe-uninitialized]
j = index(iz)
^
..\src\slsqp_core.f90:1238:0: note: 'izmax' was declared here
integer :: i,ii,ip,iter,itmax,iz,iz1,iz2,izmax,j,jj,jz,l,npp1,nsetp,rtnkey
^
gfortran %OPT_COMP% %OPT_DEBUG% slsqp_module.f90
returns:
..\src\slsqp_module.f90:158.8:
if (size(xl)/=size(xu) .or. size(xl)/=n) then
1
Warning: Removing call to function 'size' at (1)
..\src\slsqp_module.f90:458.18:
message = 'Required accuracy for solution obtained'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:460.18:
message = 'Invalid size(x) in slsqp_wrapper'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:462.18:
message = 'Invalid linesearch_mode in slsqp_wrapper'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:464.18:
message = 'Function is not associated'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:466.18:
message = 'Gradient function is not associated'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:468.18:
message = 'User-triggered stop of slsqp'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:470.18:
message = 'In progress'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:472.18:
message = 'Number of equality constraints larger than n'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:474.18:
message = 'More than 3*n iterations in lsq subproblem'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:476.18:
message = 'Inequality constraints incompatible'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:478.18:
message = 'Singular matrix e in lsq subproblem'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:480.18:
message = 'Singular matrix c in lsq subproblem'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:482.18:
message = 'Rank-deficient equality constraint subproblem hfti'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:484.18:
message = 'Positive directional derivative for linesearch'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:486.18:
message = 'More than max_iter iterations in slsqp'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:488.18:
message = 'Unknown slsqp error'
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:422.27:
str_to_write = str//' '//trim(adjustl(istr))
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:426.27:
str_to_write = str//' '//trim(adjustl(rstr))
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:428.27:
str_to_write = str
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:302.54:
if (present(status_message)) status_message = mode_to_status_message(is
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:315.54:
if (present(status_message)) status_message = mode_to_status_message(is
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:323.54:
if (present(status_message)) status_message = mode_to_status_message(is
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:329.54:
if (present(status_message)) status_message = mode_to_status_message(is
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:353.39:
call slsqp(me%m,me%meq,la,me%n,x,me%xl,me%xu,&
1
Warning: Creating array temporary at (1) for argument 'x'
..\src\slsqp_module.f90:379.50:
if (present(status_message)) status_message = mode_to_status_message(istat)
1
Warning: Code for reallocating the allocatable variable at (1) will be added
..\src\slsqp_module.f90:220.28:
allocate(me%xl(n)); me%xl = xl
1
Warning: Code for reallocating the allocatable array at (1) will be added
..\src\slsqp_module.f90:221.28:
allocate(me%xu(n)); me%xu = xu
1
Warning: Code for reallocating the allocatable array at (1) will be added
gfortran %OPT_COMP% %OPT_DEBUG% slsqp_test_2.f90
returns:
..\src\tests\slsqp_test_2.f90:103.34:
subroutine report_iteration(me,iter,x,f,c)
1
Warning: Unused dummy argument 'me' at (1)
..\src\tests\slsqp_test_2.f90:78.27:
subroutine test_grad(me,x,g,a)
1
Warning: Unused dummy argument 'me' at (1)
..\src\tests\slsqp_test_2.f90:50.27:
subroutine test_func(me,x,f,c)
1
Warning: Unused dummy argument 'me' at (1)
Can the linking also be a problem? I kept linking with this command:
gfortran -o blub.exe slsqp_test_2.o slsqp_kinds.o slsqp_support.o slsqp_core.o slsqp_module.o
Hope these log files give at least some hints. Otherwise, please let me know if you think of particular compiler options to evoke error messages.
Dear @jacobwilliams ,
I figured out that compiling with the latest gfortran version
gcc version 7.2.0 (x86_64-posix-seh-rev1, Built by MinGW-W64 project)
your two test programms converge nicely and I obtain the solutions mentioned by you.
It seems to be an compiler version issue. As I would like to call the optimization within another subroutine, I am wondering if you also have an example for that?
I don't understand what you mean by "call the optimization within another subroutine".
Dear @jacobwilliams,
I don't understand what you mean by "call the optimization within another subroutine".
this was just an issue due to my lack of knowledge in programming fortran.
So actually this issue could be marked as "solved", or at least solved from my point of view.
But may you also help me with a mathematical issue?
I often run into error message
case(8)
message = 'Positive directional derivative for linesearch'
as soon as I set more inequality constraints than the ones that need to be given by xu
and xl
.
May it help to change the linesearch mode flag from 1 to 0?
Or did I define a nonconvex solution space?
Thanks for any advice!
It's hard to say what the problem is. I have used inequality constraints so they should work. It may have something to do with your specific problem.
Line search mode 1 is what I normally use (2 is usually not worth it).
Dear @jacobwilliams,
many thanks for sharing your fortran code! As I would like to use the optimization algorithm slsqp on a windows device I tryed to build both of your test programms.
First with gfortran directly:
Then with FoBis.py similar to how you do it in your build.sh:
Both ways of building do not return errors (except some warnings with gfortran), but executing the resulting .exe files return the following error:
Unfortunately there is no backtrace mentioned. Using the mingw64 gfortran (version 4.8.0) compiler option
-Wall
produces following warnings. Compiling the slsqp_core.f90 bygfortran -c -O2 -std=f2008 -Wall .\src\slsqp_core.f90 2> log_core.txt
I get:The warnings that accure compiling the slsqp_test_2.f90 by
gfortran -c -O2 -std=f2008 -Wall slsqp_test_2.f90 2> log_Test_2.txt
are about unused dummies:Can this give you a hint about what might go wrong? May it be an issue related to the operating system? From things I tried so far it should not make a difference compiling with FoBis.py or gfortran. Any help on how to compile and link this nice optimization tool properly is pretty much appreciated. If you are interested in more test cases I can perform, please let me know.
Kind regards!