Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOBYQA recursion problem #179

Open
asenzz opened this issue Mar 23, 2024 · 3 comments
Open

BOBYQA recursion problem #179

asenzz opened this issue Mar 23, 2024 · 3 comments

Comments

@asenzz
Copy link

asenzz commented Mar 23, 2024

If I run a BOBYQA instance from within a BOBYQA cost function, the call-back pointer, which in turn calls a lambda expression with captured references to variables, seems to be overwriting the memory of the lambda expression object and the captured variables are full of junk data. I can help debug this issue, but from what I gather so far, the problem is in the Fortran code. Thanks, Z

@zaikunzhang
Copy link
Member

Hi,

Which interface are you using?

PRIMA is designed to be recursion-safe and thread-safe. This is tested during CI:

https://github.com/libprima/prima/blob/main/fortran/tests/test_bobyqa.f90#L289-L303

A more extensive test (also included in the CI) is done via the MATLAB interface:

https://github.com/libprima/prima/blob/main/matlab/tests/recursive.m

Of course, bugs may exist.

I can help debug this issue, but from what I gather so far, the problem is in the Fortran code.

It would be nice if you could help debug it, or provide a minimal working example.

One thing to check: did you use proper compiler options to enforce recursion-safety when building the Fortran library? For gfortran, it is -frecursive, and for Intel oneAPI, it is -assume recursion (Unix) or /assume:recursion (Win).

Thank you.

@asenzz
Copy link
Author

asenzz commented May 17, 2024

Hmm seems that the C interface does give problems when used in multiple threads at once. I'll let you know as soon as I have something. It happens with LINCOA. Haven't retested BOBYQUA.

@zaikunzhang
Copy link
Member

Could you provide a minimal example? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants