OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to Configure HSL MA86 for Use w/ IPOPT in OpenMDAO

  • Thread starter Thread starter ilaudo
  • Start date Start date
I

ilaudo

Guest
I am currently trying to configure the HSL MA86 linear solver for use with IPOPT in OpenMDAO. I am using a Linux Ubuntu computer. I have extracted both HSL MA86 and IPOPT from tar.gz files and created the folders in their necessary locations. I have installed BLAS, LAPACK, and METIS, all of which are dependencies for HSL MA86. I have also configured MA86 to be linked to the dependencies and their paths.

When I try to run my code using OpenMDAO, I encounter the following printout from IPOPT:

Code:
   Exit Status
      Inform  Description
         -12  Invalid Option
--------------------------------------------------------------------------------

This only occurs when I have the following line uncommented:

Code:
p.driver.opt_settings['linear_solver'] = 'ma86'

I am uncertain of why this is happening. It seems that IPOPT is not connected to HSL MA86.

It is worth mentioning that each time I attempt to run make install (after running make and make check) for HSL MA86, I encounter the following error printout snippit (actual filepaths have been redacted for privacy):

Code:
/usr/bin/install: 'include/hsl_ma86s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86s.h' are the same file
/usr/bin/install: 'include/hsl_ma86d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86d.h' are the same file
/usr/bin/install: 'include/hsl_ma86c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86c.h' are the same file
/usr/bin/install: 'include/hsl_ma86z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86z.h' are the same file
/usr/bin/install: 'include/hsl_mc68i.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc68i.h' are the same file
/usr/bin/install: 'include/hsl_mc69s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69s.h' are the same file
/usr/bin/install: 'include/hsl_mc69d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69d.h' are the same file
/usr/bin/install: 'include/hsl_mc69c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69c.h' are the same file
/usr/bin/install: 'include/hsl_mc69z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69z.h' are the same file
make[2]: *** [Makefile:418: install-includeHEADERS] Error 1
make[2]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make[1]: *** [Makefile:749: install-am] Error 2
make[1]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make: *** [Makefile:445: install-recursive] Error 1

I am wondering if this is potentially the issue? Another potential source of error could be the path not fully connecting? By default, my variable LD_LIBRARY_PATH is not set to path/to/hsl_ma86-1.7.4/lib. I use the following code structure to change it between what it originally is and to the needed path for my OpenMDAO program:

Code:
import os
import subprocess

def my_function():
    # Path to HSL MA86 libraries -- needed to temporarily change for OpenMDAO code
    ma86_path = "/path/to/hsl_ma86-1.7.4/lib"

    # Obtains the original library path necessary for other code
    original_libPath = os.environ.get('LD_LIBRARY_PATH', '')    

    try:
        # Temporarily sets the library path to HSL MA86 so that IPOPT can find it
        # os.environ['LD_LIBRARY_PATH'] = f"{ma86_path}:{original_libPath}"
        os.environ['LD_LIBRARY_PATH'] = ma86_path
        print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
        print('Subprocess executed')
        # Execute trajectory code using HSL MA86
        subprocess.run(["python", "my_openmdao_code.py"])
        

    finally:
        # Resets initial library path for use in optimization
        os.environ['LD_LIBRARY_PATH'] = original_libPath
        print('Restoration Occured')
        print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
if __name__ == '__main__':
    
    my_function()

Sorry that this is such a long post, but I wanted to provide as much detail as I could. Thanks for the help!
<p>I am currently trying to configure the HSL MA86 linear solver for use with IPOPT in OpenMDAO. I am using a Linux Ubuntu computer. I have extracted both HSL MA86 and IPOPT from tar.gz files and created the folders in their necessary locations. I have installed BLAS, LAPACK, and METIS, all of which are dependencies for HSL MA86. I have also configured MA86 to be linked to the dependencies and their paths.</p>
<p>When I try to run my code using OpenMDAO, I encounter the following printout from IPOPT:</p>
<pre><code> Exit Status
Inform Description
-12 Invalid Option
--------------------------------------------------------------------------------
</code></pre>
<p>This only occurs when I have the following line uncommented:</p>
<pre><code>p.driver.opt_settings['linear_solver'] = 'ma86'
</code></pre>
<p>I am uncertain of why this is happening. It seems that IPOPT is not connected to HSL MA86.</p>
<p>It is worth mentioning that each time I attempt to run <code>make install</code> (after running <code>make</code> and <code>make check</code>) for HSL MA86, I encounter the following error printout snippit (actual filepaths have been redacted for privacy):</p>
<pre><code>/usr/bin/install: 'include/hsl_ma86s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86s.h' are the same file
/usr/bin/install: 'include/hsl_ma86d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86d.h' are the same file
/usr/bin/install: 'include/hsl_ma86c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86c.h' are the same file
/usr/bin/install: 'include/hsl_ma86z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86z.h' are the same file
/usr/bin/install: 'include/hsl_mc68i.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc68i.h' are the same file
/usr/bin/install: 'include/hsl_mc69s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69s.h' are the same file
/usr/bin/install: 'include/hsl_mc69d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69d.h' are the same file
/usr/bin/install: 'include/hsl_mc69c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69c.h' are the same file
/usr/bin/install: 'include/hsl_mc69z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69z.h' are the same file
make[2]: *** [Makefile:418: install-includeHEADERS] Error 1
make[2]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make[1]: *** [Makefile:749: install-am] Error 2
make[1]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make: *** [Makefile:445: install-recursive] Error 1
</code></pre>
<p>I am wondering if this is potentially the issue? Another potential source of error could be the path not fully connecting? By default, my variable <code>LD_LIBRARY_PATH</code> is not set to <code>path/to/hsl_ma86-1.7.4/lib</code>. I use the following code structure to change it between what it originally is and to the needed path for my OpenMDAO program:</p>
<pre><code>import os
import subprocess

def my_function():
# Path to HSL MA86 libraries -- needed to temporarily change for OpenMDAO code
ma86_path = "/path/to/hsl_ma86-1.7.4/lib"

# Obtains the original library path necessary for other code
original_libPath = os.environ.get('LD_LIBRARY_PATH', '')

try:
# Temporarily sets the library path to HSL MA86 so that IPOPT can find it
# os.environ['LD_LIBRARY_PATH'] = f"{ma86_path}:{original_libPath}"
os.environ['LD_LIBRARY_PATH'] = ma86_path
print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
print('Subprocess executed')
# Execute trajectory code using HSL MA86
subprocess.run(["python", "my_openmdao_code.py"])


finally:
# Resets initial library path for use in optimization
os.environ['LD_LIBRARY_PATH'] = original_libPath
print('Restoration Occured')
print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
if __name__ == '__main__':

my_function()
</code></pre>
<p>Sorry that this is such a long post, but I wanted to provide as much detail as I could. Thanks for the help!</p>
 

Latest posts

Online statistics

Members online
0
Guests online
5
Total visitors
5
Top