mctools / mcpl

Monte Carlo Particle Lists
https://mctools.github.io/mcpl/
Other
28 stars 13 forks source link

MCPL file is crushing when attepting to simulate Mcstas instrument with big statistics on Windows. #57

Open karpenka opened 2 years ago

karpenka commented 2 years ago

I tried to generate first mcpl file when running instrument with 1e8 particles (component was located after guide), and while program didnt compress file to gz, it was still working when i tried to run it (file had size 1.1GB). Next time i tried to run same instrument with statistic 5e8 and get error message:

"MCPL ERROR: Errors encountered while attempting to update number of particles in file.

job aborted: [ranks] message

[0] process exited without calling finalize

[1-7] terminated

---- error analysis -----

[0] on DESKTOP-S29R61D H4-2.exe ended prematurely and may have crashed. exit code 1

---- error analysis -----"

What can be a problem? I had still a lot of availible space (>30 GB), so file should have plenty availible space for saving. This file was not working in mcstas, when i tried to use it as input. I checked in python, it looks like most trajectories are saved: "MCPL WARNING: Input file appears to not have been closed properly. Recovered 180306468 particles."

tkittel commented 2 years ago

I am not sure, and I don't have much experience with Windows. You should probably specify in what environment you are running in case some Windows expert sees this issue. I am guessing that the issue is related to specifics of your windows file system, but I am honestly not sure.

In any case, the first error message indicates an error during file closure after all particles have been written to the file and the mcpl code is trying to rewind the file handle and update what is essentially an integer field at the beginning of the file. If the sole crucial output of your McStas job was the mcpl file, it is probably OK apart from this integer field. And as you can see, mcpl is able to anyway deduce the number of particles by looking at the file size. Thus, you can "repair" the file by asking mcpltool to try to fix this integer field in the file header by running:

mcpltool --repair nameofyourfile.mcpl

The main purpose of this will be to remove the WARNING when using the file in the future. You can also gzip the file manually if you wish to save space.

tkittel commented 2 years ago

Might be related to #40

karpenka commented 2 years ago

Thank you for reply! I am running McStas 2.7.1, Windows 10. I tried to fix this file with your suggestion, it was unsuccessful. Messages bellow.

When running mcpltool --repair: "MCPL ERROR: File does not appear to be broken."

When attepting to use this mcpl file in McStas instrument: "[H4_2] Initialize Warning(mcpl_input): MCPL-file reports no present particles. Foolishly trying to go on.

Warning: You are using MCPL_input with a repeat_count of 1:

Initialize ncount is 0 MCPL_input verbose mode - outputting data on the 10 first read neutrons in MCPL units:

Save [H4_2] Detector: monitor_nd_I=0 monitor_nd_ERR=0 monitor_nd_N=0 "monitor_nd_1649943643.L" "

So, problem seems that McStas cant read particles from file? This is from python: изображение

tkittel commented 2 years ago

I would like to assist further, but from your message it looks like you might be working at the PIK reactor, and my employer currently has a very strict policy against me providing any support or collaboration with Russian institutes...