Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Link Linux CPLEX to Fortran

    Posted 04/08/15 02:59 PM

    Originally posted by: 7DNV_Miguel_Casquilho


    What are the parameters to give the compiler/linker  in Linux to use CPLEX in Fortran ?

    I have been mimicking C ---so, using '-lcplex'---, but always get "ld: cannot find -lcplex".

    I guess my CPLEX is version "126" (this is possibly 12.6) and the dates I see are May-2014..


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 03:35 PM

    I am not a Fortran programmer, but are you using -L to specify where libcplex can be found?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 05:08 PM

    Originally posted by: 7DNV_Miguel_Casquilho


    //--Dear helper --- (Wed, 08Apr2015, 22h00 Lisbon) Thanks ! I am using, in despair, the following. Is it too much ?
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    intel/Compiler/11.1/059/bin/intel64/ifort \
    -I/afs/ist.utl.pt/users/3/8/ist11038/opt/ibm/ILOG/CPLEX_Studio126/cplex/include \
    -DIL_STD \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/cplex/bin/x86-64_linux \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/cplex/include/ilcplex \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/cplex/lib/x86-64_linux \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/opl/bin/x86-64_linux \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/opl/include/ilcplex \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/opl/lib/x86-64_linux/static_pic \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/opl/bin/x86-64_linux \
    -lpthread LPex1.f90 -lm -lcplex

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
        I always obtain: ld: cannot find -lcplex
    Miguel Casquilho--//


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 05:41 PM

    You are only trying to link with the Callable Library (C API), correct?

    The placement of the -l option can be significant.  Maybe try the following:

    intel/Compiler/11.1/059/bin/intel64/ifort \
    -I/afs/ist.utl.pt/users/3/8/ist11038/opt/ibm/ILOG/CPLEX_Studio126/cplex/include \
    -L~/opt/ibm/ILOG/CPLEX_Studio126/cplex/lib/x86-64_linux/static_pic \
    -lcplex -lm -lpthread LPex1.f90

    I did several things here.  I removed stuff that I think is unecessary based on the assumption that you only intend to link with the Callable Library.  I changed the order of the -l's, preceded -lcplex with -L (the path to libcplex.a), and added static_pic onto the end of the path.  This is based off of my experience compiling C, so I have no idea if this will do the trick for you.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 06:03 PM

    Originally posted by: 7DNV_Miguel_Casquilho


    I think THAT was a real advance. I now have some response from the compiler (even if it's bad):

    =============================
    /tmp/ifortiMexYX.o: In function `MAIN__':
    LPex1.f90:(.text+0x48): undefined reference to `cpxopencplexdevelop_'
    LPex1.f90:(.text+0x6f): undefined reference to `cpxsetintparam_'
    LPex1.f90:(.text+0x280): undefined reference to `cpxcreateprob_'
    LPex1.f90:(.text+0x32d): undefined reference to `cpxcopylp_'
    LPex1.f90:(.text+0x39c): undefined reference to `cpxprimopt_'
    etc.
    =============================

    Is it a matter of underscore ? Of lower/upper-case ? Fortran is case-insensitive (except, of course, in character strings).


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 06:20 PM

    You've entered into the realm where, with my lack of Fortran experience, I probably can't be of much more help.  However, I did see mention of an underscore issue here (with g77 there is a "-fno-underscore" flag).  I'm not sure if this is possible with the Intel Fortran compiler or not.

    Good luck ... maybe someone else can help you further.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Link Linux CPLEX to Fortran

    Posted 04/08/15 07:20 PM

    Originally posted by: 7DNV_Miguel_Casquilho


    You're right. I'm almost there. I easily got rid of the underscore, but could not solve the uppercase problem (which is otherwise mentioned in the example source itself). I guess that's the only issue, so I am now in a much better state than before your help. Thanks !


    #CPLEXOptimizers
    #DecisionOptimization