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

s2a gives strange output #162

Open
savchenkoyana opened this issue Dec 21, 2024 · 14 comments
Open

s2a gives strange output #162

savchenkoyana opened this issue Dec 21, 2024 · 14 comments

Comments

@savchenkoyana
Copy link

savchenkoyana commented Dec 21, 2024

Dear maintainers,

Thank you for this repository!

I use NEMO tools for my analysis (e.g., s2a, manipulate, etc.). What I recently encountered is that s2a gives strange output for my nemo file. When I use something like this:

s2a my_file.nemo out_a times=0.0

The resulting file out_a looks like it was printed several times all over again: dashes with text, then correct output lines (full), the dashes, the output all over again.

I tried to debug it putting a std::cout after the line https://github.com/teuben/nemo/blob/master/usr/dehnen/falcON/src/public/exe/s2a.cc#L154
So I got as much std::cout prints as there are duplicates in s2a output.
I also face duplicated output when I use manipulate command.

Is this behavior expected? I think maybe the bug comes from the fact that my snapshot is very large. Is there a way to fix this?

Sincerely,
Yana

@teuben
Copy link
Owner

teuben commented Dec 21, 2024

How large is the snapshot. Can you give me the history of the snapshot with the "hisf" command.

@teuben
Copy link
Owner

teuben commented Dec 21, 2024

you could also use "snappprint my_file.nemo times=0" which has an output similar to s2a, to see if that fails too

@teuben
Copy link
Owner

teuben commented Dec 21, 2024

mkplummer p10 10 
hackcode1 p10 p10.out fcells=2 
snapprint p10.out times=0
s2a p10.out times=0

that last command failed because s2a doesn't know how to skip diagnostic frames, see the command tsf how it looks inside. Not sure if your file has diagnastics.

@savchenkoyana
Copy link
Author

  • Snapshot size is 84 Gb
  • The output of hisf command:
    hisf snap_mu0.0_s1.0_sigma1.0_r10.0_N20000_06_12/out_postprocessed.nemo
    is as follows:
    snapscale - snap_mu0.0_s1.0_sigma1.0_r10.0_N20000_06_12/out_postprocessed.nemo rscale=1000.0 VERSION=3.2b
    snapmask snap_mu0.0_s1.0_sigma1.0_r10.0_N20000_06_12/out.nemo - select=0:19999 VERSION=1.9a
    gyrfalcON snap_mu0.0_s1.0_sigma1.0_r10.0_N20000/IC_preprocessed.nemo snap_mu0.0_s1.0_sigma1.0_r10.0_N20000/out.nemo logstep=3000 eps=0.0003684031498640387 kmax=15 tstop=14 step=1.8693875619711035e-04 Grav=4.30091727067736e-06 VERSION=3.6
    Shortly: I create initial conditions IC_preprocessed.nemo with Agama (SMBH at a center + cluster at its orbit), evolve it to obtain out.nemo, scale to change units (kpc->pc) and mask to get rid of SMBH in snapshot data to finally get out_postprocessed.nemo
  • both out.nemo and out_postprocessed.nemo have the same bug with s2a command
  • snapprint gives the same bug (duplicates printing 2-3 times instead of 1)

@savchenkoyana
Copy link
Author

I prepared a smaller snapshot overnight (I used the same procedure as previously but set higher tstep in gyrfalcON command). The new snapshot size is about 2Gb and it does not give duplicates in s2a...

@teuben
Copy link
Owner

teuben commented Dec 22, 2024 via email

@teuben
Copy link
Owner

teuben commented Dec 22, 2024 via email

@teuben
Copy link
Owner

teuben commented Dec 22, 2024 via email

@teuben
Copy link
Owner

teuben commented Dec 22, 2024 via email

@savchenkoyana
Copy link
Author

savchenkoyana commented Dec 23, 2024

I did the simulation with size 7.4Gb, it is okay. So for simulations with 7Gb and 2Gb the output of s2a myfile.nemo out_a times=0 looks like this:

# ... (lines with comments)
# 'mass ' 'pos  ' 'vel  '
#
... (lines with data for particles)

But for the first simulation it is like this:

# ... (lines with comments)
# 'mass ' 'pos  ' 'vel  '
#
... (lines with data for particles)
# ... (lines with comments)
# 'mass ' 'pos  ' 'vel  '
#
... (lines with data for particles)
# ... (lines with comments)
# 'mass ' 'pos  ' 'vel  '
#
... (lines with data for particles)

So basically in all cases i have 20000 particles and expect to get ~20000 rows in s2a output, but with the large simulation file I get the same output multiple times (for example, s2a output could have ~60000 lines just like in example above).

I still can use it though by only loading the data between two group of comment lines.

@teuben
Copy link
Owner

teuben commented Dec 23, 2024

I had the experience in NEMO that I also got multiple of 20,000 particles, which in turn depended on the TIMEFUZZ value that is hardcoded in many NEMO programs. s2a is from FALCON, which is has different methods. I fixed all of NEMO (we have a new version 4.5) that ensures one common TIMEFUZZ now defined in <stdinc.h> -

but this doesn't solve your s2a problem.

Did you try snaptrim? It has a keyword where you can set the timefuzz= parameter

@savchenkoyana
Copy link
Author

Yes, I've just tried snaptrim, seems like it works, thanks!

May I ask a couple of questions?

  • So just to be clear, should I use the default timefuzz=0.000001 for large snashots?
  • Another question is: after I update NEMO to the current version 4.5.0, s2a won't be fixed, right? And snapprint too? Is there a way to know beforehand the name of other NEMO programs that still have the same peculiarities so that I'm super careful when using them?
  • Does timefuzz problem only arise with super large snapshot or it could happen with normal snapshots when reading from disk is super slow?

@teuben
Copy link
Owner

teuben commented Dec 23, 2024 via email

@teuben
Copy link
Owner

teuben commented Jan 2, 2025

Slightly related is a bug in NEMO when an item is over 4GB (which doesn't happen with your snapshots) it seems to fail. This is mentioned in #17 and no doubt is an old relic of the code not converted to 64bit integers.

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