Project

General

Profile

Support #1254

St9bad_alloc errors plotting in Python

Added by Carlisle, Timothy over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
bin(aries)
Target version:
Start date:
16 April 2013
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

I'm getting the dreaded: "terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
" (memory related) errors when trying to trying to loop over my virtual planes & make plots, (the same approach given in Xboa Example 2) e.g.:

Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['x'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['pz'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['energy'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'mean', ['time'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'beta', ['x','y'], 'm', 'mm')
Bunch.root_graph(bunch_list, 'mean', ['z'], 'emittance', ['x','y'], 'm', 'mm')

etc

I get the same error if I simply fill arrays, e.g.:

for Plane in range( 0, len(bunch_list)-1 ):
my_bunch = bunch_list[Plane]
_x= round(my_bunch.get('mean', ['x'] ), 2)
_y= round(my_bunch.get('mean', ['y'] ), 2)
etc

my simulations have 10,000 muons, and >100 planes which probably isn't helping the memory side of things...I'm not well versed in Python at all, any advice on how to get round this?

Thanks,

Tim


Files

Xboa_Example2_TimEdit.txt (2.52 KB) Xboa_Example2_TimEdit.txt Carlisle, Timothy, 16 April 2013 13:13
log.out (9.91 KB) log.out Carlisle, Timothy, 16 April 2013 16:08
log2.out (2.7 KB) log2.out Carlisle, Timothy, 16 April 2013 16:11
#1

Updated by Rogers, Chris over 10 years ago

  • Target version set to Future MAUS release

Which version of xboa are you using? Can you attach the full script?

Cheers

#2

Updated by Rogers, Chris over 10 years ago

Note xboa version is

import xboa.Common
print xboa.Common.xboa_version
#3

Updated by Carlisle, Timothy over 10 years ago

Hey Chris,

I'm using 0.15. Example 2 script attached (matplot stuff removed). I've added 2 statements to output beta(z) and emittance(z), which are producing the errors.

Thanks

#4

Updated by Rogers, Chris over 10 years ago

I had a memory leak "blitz" in 0.15.1, available here:

http://micewww.pp.rl.ac.uk/maus/xboa/

See if that fixes your problem.

To install, follow instructions here

#5

Updated by Rogers, Chris over 10 years ago

Also, if you have a record of the output could you send it through to me?

#6

Updated by Carlisle, Timothy over 10 years ago

Ah great thanks, installing new Xboa at the moment.
Do you mean a proper error log output?

#7

Updated by Carlisle, Timothy over 10 years ago

Do I need to re-config Maus first? It can't find python it seems...vaguely remember this happening before. Maus0.5 has Python-2.7.2 bundled I think.

~/maus0.5_orig/third_party/build/xboa-0.15.1 python setup.py build
running build
running build_py
running build_ext
building 'xboa.core.Bunchcore' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/carlisle/maus0.5_orig/third_party/install/include/python2.7 -c xboa/core/Bunchcore.c -o build/temp.linux-x86_64-2.7/xboa/core/Bunchcore.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/xboa/core/Bunchcore.o -L/home/carlisle/maus0.5/third_party/install/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/xboa/core/Bunchcore.so
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

#8

Updated by Rogers, Chris over 10 years ago

Need to source env.sh first

#9

Updated by Rogers, Chris over 10 years ago

I was going to phone but looks like they took the contact details off the John Adams website(!)

I noticed you had the path as:

/home/carlisle/maus0.5

and in some places:

/home/carlisle/maus0.5_orig

looks like this is causing problems.

#10

Updated by Carlisle, Timothy over 10 years ago

log file

#11

Updated by Carlisle, Timothy over 10 years ago

take 2

#12

Updated by Rogers, Chris over 10 years ago

  • Category set to bin(aries)
  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Resolved with phone call to Tim. Looks like he encountered memory problems associated with bugs in 0.15.0 which were fixed in 0.15.1 - talked Tim through the installation process, following which things looked okay.

Also available in: Atom PDF