Giter VIP home page Giter VIP logo

paropt's Introduction

Build, unit tests, and docs

Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge

ParOpt: A library of parallel optimization algorithms


ParOpt is a parallel optimization library for use in general large-scale optimization applications, but is often specifically used for topology and multi-material optimization problems. The optimizer has the capability to handle large numbers of weighting constraints that arise in the parametrization of multi-material problems.

The implementation of the optimizer is in C++ and uses MPI. ParOpt is also wrapped with python using Cython.

The ParOpt theory manual is located here: ParOpt_theory_manual

Online documentation for ParOpt is located here: https://smdogroup.github.io/paropt/

If you use ParOpt, please cite our paper:

Ting Wei Chin, Mark K. Leader, Graeme J. Kennedy, A scalable framework for large-scale 3D multimaterial topology optimization with octree-based mesh adaptation, Advances in Engineering Software, Volume 135, 2019.

@article{Chin:2019,
         title = {A scalable framework for large-scale 3D multimaterial topology optimization with octree-based mesh adaptation},
         journal = {Advances in Engineering Software},
         volume = {135},
         year = {2019},
         doi = {10.1016/j.advengsoft.2019.05.004},
         author = {Ting Wei Chin and Mark K. Leader and Graeme J. Kennedy}}

ParOpt is released under the terms of the LGPLv3 license.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

paropt's People

Contributors

aaronyicongfu avatar chintw90 avatar gjkennedy avatar hwangjt avatar komahanb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

paropt's Issues

help: could you tell me how to build and debug paropt in visualGDB, or other software that can build or debug paropt

hi,
My lab wanna work through your paper paropt. So first thank you for your paper and your contribution. In order to figure out the process of getting the final result, to figure out how paropt works, we think debug the program step by step may works. And now I see there no build program availble. So I am trying to creat a new project, add the source code in my project to debug step by step. I am using VisualGDB, the cross platform software. When debuging the program, mistakes always occur. And I am still a learner on the way, some problems are beyond my abality to fix it. So I am here to ask for help about the way or solution to build and debug paropt. And I wanna know the way you program paropt, using what software, under what situation. My mailbox is [email protected]. If there is a pdf introducing how to build paropt would be great.

Thanks a ton!

Build fails because missing GKlib

I had an issue with the build of ParOpt. I could compile everything and it worked until i tried to import ParOpt. Here is the error:

python3 -c "from paropt import ParOpt":                                                                                  
Traceback (most recent call last):                                                                                                
File "<string>", line 1, in <module>                                                                                            
ImportError: /root/git/paropt/lib/libparopt.so: undefined symbol: gk_jbufs

I could solve it by building the library together with libGKlib.a. But as far as i see it there is nothing saying so. I would add something in Makefile.in to configure the paths and then also add the library at build.

Compilation error Python 3.10

Hi,
I'm trying to compile ParOpt under pyenv with Python 3.10-dev. The compilation via make of the C-part is working fine. But when I run:

python3 setup.py install

I get:

Warning: passing language='c++' to cythonize() is deprecated. Instead, put "# distutils: language=c++" in your .pyx or .pxd file(s)
Compiling paropt/ParOpt.pyx because it changed.
Compiling paropt/ParOptEig.pyx because it changed.
[1/2] Cythonizing paropt/ParOpt.pyx
/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /optimizer/py/paropt/paropt/ParOpt.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...

# Import the string library
from libcpp.string cimport string

# Import the declarations required from the pxd file
from ParOpt cimport *
^
------------------------------------------------------------

paropt/ParOpt.pyx:16:0: 'ParOpt.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
    ndarray = np.PyArray_SimpleNewFromData(size, shape,
                                           nptype, data_ptr)

    if base is not None:
        Py_INCREF(base)
        ndarray.base = <PyObject*>base
               ^
------------------------------------------------------------

paropt/ParOpt.pyx:377:15: Assignment to a read-only property

Error compiling Cython file:
------------------------------------------------------------
...
        cdef MPI_Comm c_comm = comm.ob_mpi
        if nineq < 0:
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
                                    ^
------------------------------------------------------------

paropt/ParOpt.pyx:750:36: Cannot assign type 'void (void *, int, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'getvarsandbounds'

Error compiling Cython file:
------------------------------------------------------------
...
        if nineq < 0:
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
                              ^
------------------------------------------------------------

paropt/ParOpt.pyx:751:30: Cannot assign type 'int (void *, int, int, ParOptVec *, ParOptScalar *, ParOptScalar *) except? -1' to 'evalobjcon'

Error compiling Cython file:
------------------------------------------------------------
...
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
                                      ^
------------------------------------------------------------

paropt/ParOpt.pyx:752:38: Cannot assign type 'int (void *, int, int, ParOptVec *, ParOptVec *, ParOptVec **) except? -1' to 'evalobjcongradient'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
                                   ^
------------------------------------------------------------

paropt/ParOpt.pyx:753:35: Cannot assign type 'int (void *, int, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *, ParOptVec *) except? -1' to 'evalhvecproduct'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
                                   ^
------------------------------------------------------------

paropt/ParOpt.pyx:754:35: Cannot assign type 'int (void *, int, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *) except? -1' to 'evalhessiandiag'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
                                                      ^
------------------------------------------------------------

paropt/ParOpt.pyx:755:54: Cannot assign type 'void (void *, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'computequasinewtonupdatecorrection'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
                                 ^
------------------------------------------------------------

paropt/ParOpt.pyx:756:33: Cannot assign type 'void (void *, int, int, ParOptVec *, ParOptVec *) except *' to 'evalsparsecon'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
                                     ^
------------------------------------------------------------

paropt/ParOpt.pyx:757:37: Cannot assign type 'void (void *, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'addsparsejacobian'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
        self.me.setAddSparseJacobianTranspose(_addsparsejacobiantranspose)
                                              ^
------------------------------------------------------------

paropt/ParOpt.pyx:758:46: Cannot assign type 'void (void *, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'addsparsejacobiantranspose'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
        self.me.setAddSparseJacobianTranspose(_addsparsejacobiantranspose)
        self.me.setAddSparseInnerProduct(_addsparseinnerproduct)
                                         ^
------------------------------------------------------------

paropt/ParOpt.pyx:759:41: Cannot assign type 'void (void *, int, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptScalar *) except *' to 'addsparseinnerproduct'
Traceback (most recent call last):
  File "/optimizer/py/paropt/setup.py", line 122, in <module>
    ext_modules=cythonize(exts, language="c++", include_path=inc_dirs),
  File "/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: paropt/ParOpt.pyx

Any idea, how I can resolve this?

Thanks!

ParOpt should provide version tagging

As explained in #5, recent changes in ParOpt broke the regression test suite for pyOptSparse, which has actually happened previously due to similar problems (#4). I think due to the fact that ParOpt is still in active development with constantly changing API/functionality, it's important to have periodic releases with the code properly version tagged. That way, pyOptSparse can pin a stable release both for testing, and for users to install from, knowing that it has been tested to work with a given version of pyOptSparse. This is currently done for all other external optimizers (i.e. those not shipped with pyOptSparse).

Until ParOpt provides version tagging, I'm afraid we will have to drop ParOpt support within pyOptSparse. The wrapper will remain intact within the package, but we will no longer test ParOpt since build and regression test issues will cause our regression tests to fail, and pyOptSparse should not be testing the ParOpt build process anyhow.

writeOuput method does not work.

Hi, I've written my custom ParOpt.Problem class:

class MyProb(ParOpt.Problem):
    def __init__(self, *args):
        # something ...
        # ...

    ....

    def writeOutput(self, iter, x):
        print(iter) # This is an example

as described in the document:

virtual void writeOutput(int iter, ParOptVec *x)ΒΆ
Implement this function if you'd like to print out something with the same frequency as the output files

But I cannot see anything on my terminal. I think my writeOutput method in MyProb does not work.
How can I monitor the optimization process in my own way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.