Super mode full dimension correction gives memory error
Added by LIGE TONGGU over 10 years ago
Dear all,
I am trying to do bright/dark correction in 'Correction' node of 'MSI-T'. For gr, hl, sq, fa, I am using counted mode and the corrections were going smoothly. For ed, I use super mode 200ms each frame and total 10000ms exposure in preset_manager selector setting. For the 7676*7420 bin1 correction, I tried 200ms, no frames, average 2 and 1000ms average 5. I first collect 'Raw' for 'Channel 0', then 'Dark' for 'Channel 0', then 'Bright' for 'Channel 0' and finally 'Corrected'. But there was 'memory error' in this process. Sometimes the error pop out after 'Bright', sometimes after 'Corrected'. Then I have to kill the application. I checked memory and our free memory is around 14GB, so it should not be the reason. Our leginon version is 3.0 and DM version is 2.30. I also include the Bright and Dark refs min, max, mean here since I am not sure what is the normal range for super mode refs:
'14may24b_24161950_00_7676x7420_dark_0.mrc';
Range: 0 mean=0 sigma=0
Min: 0 Max:0
'14may24b_24161959_01_7676x7420_norm_0.mrc';
Range: 0.43243 mean=0.43208 sigma=0.034468
Min: 5.7666e-05 Max:0.43249
'14may24b_24162033_02_7676x7420_bright_0.mrc';
Range: 10 mean=0.89081 sigma=0.68412
Min: 0 Max:10
'14may24b_24162036_03_7676x7420_norm_0.mrc';
Range: 1.6925 mean=1.0776 sigma=0.50266
Min: 0.089081 Max:1.7816
memory.tif (634 KB) memory.tif | |||
Leginonmessagedisplay.png (263 KB) Leginonmessagedisplay.png |
Replies (21)
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
Tonggu,
I have a test machine with 4 GB memory and it did fine with 1000 ms average 5. 14GB memory should not give you problem. However, my test machine only runs processing side of Leginon, i.e., no webserver nor database server. That could be the difference.
Could you take a screenshot of memory usage graph (Access thru pull down menu of CentOS main menu under "System Tools/System Monitor" and tag "Resources") during such an operation ?
The first time you try to use Leginon bright image collection, it should increase memory during each imag acquisition, and then drop as it is released before the next image acquisition but not quite to the original level. After all 5 images were acquired, more memory is used in order to calculate and save the norm image which will use most memory. After that, part of the memory is released. The part not released is considered as cache which allow the next norm image calculation to go faster. We allow Leginon process to cache up to 50% memory. Therefore, the next time you try to go through the same process without closing Leginon, the baseline where it returns to at the end of everything will increase until it is roughly 50 %. Here I attach one after my baseline reached 50 %.
If you have an all-in-one system and such a large total memory. Leginon corrector cache might have used more than what it should have. Or other processes took up so much memory that there is not enough to process the 8k images during norm image calculation.
memory.png (46.3 KB) memory.png |
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Dear Anchi,
I tested again as you suggested. I chose super mode, 1000ms and average 5 without saving frames. The memory error appeared after the second acquisition of bright image. I attached my Monitor screenshots for each step. I think the Memory history looks fine and I am not sure what the problem is.
Thanks,
Lige
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
Hi, Lige,
I just noticed one thing. MemoryError is an error coming from pyscope/safearray.py which K2 camera does not use. Could you check your instruments.cfg ?
It should look like this Gatan_K2_Instruments_cfg
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
By the way, the instruments.cfg I mentioned is the one on the camera computer. On your linux box, it should either be empty or be the same as the template which contains only simulation camera and scope.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Dear Anchi,
Thank you for your suggestions. I think you are right. Below is the instruments.cfg on Gatan computer. Only simulation camera and scope. Do you know how to fix this? Is that the reason our DM and Leginon doesn't communicate well? I noticed that when I set ED to use K2super and sent ED to scope, DM still displays Counted. Also, I am wondering why we do not seem to have problems if we use counting mode for all parameters?
Thank you so much!
Instruments_cfg.png (92.8 KB) Instruments_cfg.png |
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
First, make sure that it is the instruments.cfg leginon reads. Check it with Locate_global_config_directory_on_Windows. If it is the one the script says it reads, it surprises me that it ever works. Tell me more about the configuration. Does the microscope have multiple camera, including ones using comtypes (TIA controlling or Gatan camera on 32-bit processor) ?
If instruments.cfg on K2 computer is indeed incorrect, you just need to make correction in the config file. Just remember that instruments.cfg on the particular computer should only include the camera primarily controlled by that computer and should not be duplicated on another computer.
Regarding the DM gui not changing with setting of camera mode from Leginon, don't worry about it. The call to change camera mode is lower level than the gui. It unfortunately does not change what you see in the gui.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
H Anchi,
You are right! The one Leginon read is attached. The interesting thing is that the wrong cfg I attached earlier is from C:\Users\Administrator\Recent and modified today. So to make super mode work, should I delete other copies of cfg on Gatan computer?
Thanks!
real_cfg.png (35.5 KB) real_cfg.png |
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
Leginon will only use the one found as priority in that computer, but it would not hurt removing ones that can cause future confusion.
Since K2 camera computer does not control a real scope, you should remove Sim TEM.
What does the instruments.cfg on the microscope computer looks like ? That should contain only the scope, unless you have another camera that you need access to from Leginon there.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Hi Anchi,
The instruments.cfg on TEM computer is attached. Only Sim TEM and Sim Cam. The location for cfg is C:\Program files\myami\instruments.cfg.
Should I delete Sim TEM part on both Gatan computer and TEM computer or only delete SimTEM on Gatan computer?
Thanks!
instruments.cfg (2.31 KB) instruments.cfg |
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
Yes.
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
Delete camera on microscope computer and delete TEM on camera computer. What the module name (The part in the bracket such as Sim TEM in your most recent config file) is just an alias. The class name listed under that (tecnai.Tecnai in this case) is the important part.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Hi Anchi,
We changed both instruments.cfg files on Microscope computer and camera computer and restarted the Leginon.clients. However, I still got the same 'Memory Error' When I run Bright Correction for super mode. The instruments.cfg on linux box only has Sim TEM and Sim Cam and seems fine. What should I do?
Thanks!
RE: Super mode full dimension correction gives memory error - Added by Sargis Dallakyan over 10 years ago
It seem that this can happen if you have installed and running leginon using 32-bit python - http://stackoverflow.com/questions/19960166/what-are-the-workaround-options-for-python-out-of-memory-error
Please run the following command and send us the output to see if your default system python is 32 or 64 bit:
python -c 'import platform; print platform.architecture()' more /usr/bin/start-leginon.py which python
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Hi Sargis,
Yes. We are using 32 bit. Do you know how to solve this?
Thanks!
python.tif (642 KB) python.tif |
RE: Super mode full dimension correction gives memory error - Added by Sargis Dallakyan over 10 years ago
Hi Lige,
You'll need to do a fresh install of 64-bit CentOS. That's the default download version at http://www.centos.org/download/
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Thanks! Probably it is because that we are using 32bit system so the memory for each software is within 2GB. I will install the 64bit version.
RE: Super mode full dimension correction gives memory error - Added by Sargis Dallakyan over 10 years ago
You are welcome. Let us know if that helps.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Hi Anchi,
I heard that Leginon 3.1 is online now. I am trying to reinstall Leginon on the 64 bit CentOS6.5. Previously, we have Leginon 3.0 on 32bit CentOS. Our detector is K2. I am wondering do you recommend me to install Leginon 3.1 or Leginon 3.0. If I install 3.0, I assume I do not need to do anything on the microscope computer and K2 computer. If I install 3.1, do I need to upgrade the packages on microscope computer and K2 computer as well?
Thanks!
Lige
RE: Super mode full dimension correction gives memory error - Added by Anchi Cheng over 10 years ago
The change from 3.0 to 3.1 are small enough for K2 implementation, you can either stay at 3.0 or upgrade as long as you are consistent on all installed locations.
Yes, if you install 3.1 on your linux processing computer, you should upgrade the packages (just the one we distributed as python code) on microscope and K2 computers.
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Thank you!
RE: Super mode full dimension correction gives memory error - Added by LIGE TONGGU over 10 years ago
Hi Anchi and Sargis,
Now I have updated the system to 64bit CentOS and the Leginon runs smoothly. The previous memory could result from the 32bit python.
Thank you!