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

BUG: Tao crash with DE optimizer #1351

Open
ChristopherMayes opened this issue Jan 4, 2025 · 4 comments
Open

BUG: Tao crash with DE optimizer #1351

ChristopherMayes opened this issue Jan 4, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ChristopherMayes
Copy link
Contributor

Describe the bug
There is a crash when optimizing bmad-doc/tao_examples/optics_matching

Minimal Working Example

cd bmad-doc/tao_examples/optics_matching
tao

Tao> use var quad
  quad[1:6]                                      Using: 1:6

Tao> set global optimizer = de

Tao> run
Optimizing with: de
Type ``.'' to stop the optimizer before it's finished.
Differential evolution optimizer, population: 30
[INFO] lattice_bookkeeper:
    Stale bookkeeping status flags detected at element: P2\Q1 (0>>5).
    Please contact DCS!
    Status:      2     2     1     1     1
[INFO] lattice_bookkeeper:
    Stale bookkeeping lord_status flags detected.
    Please contact DCS!
    Status:      2     2     1     1     1
tao(50503,0x1706b7000) malloc: *** error for object 0x6000024cc040: pointer being freed was not allocated
tao(50503,0x1706b7000) malloc: *** set a breakpoint in malloc_error_break to debug



Compiler and Operating system
macOS with gcc14

@ChristopherMayes ChristopherMayes added the bug Something isn't working label Jan 4, 2025
@eiad-hamwi
Copy link

@DavidSagan I am also seeing this bug on my conda install on macOS (with openMP).

When using the CLASSE cluster compiled release (without openMP) I do not get this bug with DE optimizer. I am guessing this has something to do with openMP.

@DavidSagan DavidSagan self-assigned this Jan 7, 2025
@DavidSagan
Copy link
Member

Yes it does indeed look like an openMP problem.

@DavidSagan
Copy link
Member

The solution is that the tao_super_universe struct has to be duplicated so that there is one per thread. There is a lot of bookkeeping for this so in the meantime I will revert the code to using the non-openMP version of DE.

@DavidSagan
Copy link
Member

Update: The work to be done involves making the super_universe a local variable and not global. This means modifying nearly all of the routines in Tao to take the super_universe as an argument and modifying all the calls to the routines to add this argument. Also super_universe creation and destruction code needs to be implement that properly handles all the pointers that are used in the structures. This would be a good job for a student.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants