Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.8K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Script ran with MathKernel -script much slower than in the notebook

Posted 11 years ago

Dear all,

This is my first post so please bear with me if I am a bit naïve about the netiquette or other conventions.

I am post processing lot of experimental data using Mathematica. I have created the notebook with all the instructions to load the data set from an Excel file, do the basic post processing and then run a MonteCarlo simulation on it to obtain the error propagation.

The MonteCarlo simulation is a pretty intensive calculation. Mainly due to the large number of iterations. My test data are transient data and for each second of data I run 10000 MonteCarlo iterations. To give you an example for 38 points in time, the 10000 MonteCarlo iterations require 1600 seconds. I am quite ok with this time for calculation as I am running on my PC and I can leave it running during the night. Now, since I have to repeat the same analysis over 20 or 30 data sets I transformed everything in a .m file. And set it so that I can pass some variables to it and I wanted to run it from command line on each data set. Everything works properly except that it is much much slower. While the notebook does one MC iter per time step in 4.2 milliseconds, the script does it in 25 milliseconds. So it took forever to complete one MC analysis and then I stopped it. Has anyone met the same strange behavior?

I am posting this from home and I haven't here a license for Mathematica but I will try to post a minimal working example from work tomorrow. I am using Mathematica 9.

Regards, Massimiliano

4 Replies

I was wondering if it was related to parallelization or something. I tried the Parallelize command on the table command itself but I received errors.

Hm, strange. With Mathematica 10 and Mathematica 9 on Windows I get about 12.1 sec in all cases.

I'm using a local directory (I called it "C:\Users\arnoudb.WRI\scriptslowdown\") because my Documents directory is a network backed directory, which can lead to slowness itself (you might want to see if you have the same issue, saving locally to a drive is usually faster, especially when you are writing a lot of data (which is not an issue in this case though)).

POSTED BY: Arnoud Buzing

Does your code have any TimeConstrained or MemoryConstrained expressions in it? [#49655]

POSTED BY: Arnoud Buzing
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard