Running simultaneous computation in mathematica

In summary: Get["MyStuff.m"]If you have many things to save, consider using Compress:s = Compress[{M,N,P,Q,R}]Save["MyStuff.m",s]s = Get["MyStuff.m"]{M,N,P,Q,R} = Uncompress[s]In summary, Mathematica has a front end and a kernel, which can only do one calculation at a time. Although there are some limited abilities for parallel computation, it may not be what you need. You can purchase additional kernels or Premier Support from Wolfram to run multiple calculations simultaneously. As for saving and remembering calculations, you can use DumpSave or manually create assignment statements in your notebook. Another solution is to use Save and Get to
  • #1
yashar
31
0
hi
when i run a heavy computation on mathematica in the same time even if i want to calculate 2+2 , mathematica does not calculate it until calculating of heavy computation finishes.
why?

another problem is that when i do a heavy computation and obtain results , after closing mathematica and opening it again mathematica do not remember its calculations in that notebook.
for example if the result of calculation is a matrix then after closing and opening of mathematica for manipulating that matrix , for example multiplication it by itself i have to run the heavy computation again and obtain the resulting matrix again.
is there any solution that mathematica without running again a notebook remember calculation of that notebook?
sorry for my bad English writing.
thanks
 
Physics news on Phys.org
  • #2
Mathematica has a front end, which formats and displays results, and a kernel, which does almost all the computation. The kernel does one calculation at a time. That is why you can do <shift><enter> on two or more expressions on the screen and those will be passed to the kernel to complete when the kernel has finished the previous calculation.

With version 8 there have been some limited abilities to do parallel calculations
http://reference.wolfram.com/mathematica/guide/ParallelComputing.html
but I suspect this may not be what you want done.

There is one other possible solution. You can purchase a license for additional kernels from Wolfram. Then I believe you can run all the kernels you have license for at the same time. Or you can purchase Premier Support. That should provide you with one additional license and you might be able to run both of those at the same time. I have never tried this so you should make certain this will do what you need before paying your money.

For your second question, it is true that Mathematica does not remember all the state of a computation. You might look at the documentation for DumpSave and see if that will accomplish what you need.

You can manually create assignment statements in your notebook. Then the next time you start the notebook you can evaluate those assignment statements to restore the value of variables.

Mathematica, and almost all other software, forgets all current work, all open windows, all open files, all variable assignments, etc. when you exit and restart, even when you reload a saved file. I wonder if this might be because Windows and window software had a long history of bugs and errors and being unstable and the programmers thought they might make this somewhat less visible and a problem if they did not restore everything after a shut down or restart and made you manually begin again.

Good mathematics is more important than good English, just as long as we can both understand. Your use of English is almost certainly better than my use of any other human language. For that I am also sorry.
 
  • #3
yashar said:
hi
is there any solution that mathematica without running again a notebook remember calculation of that notebook?
sorry for my bad English writing.
thanks

How about saving the results to a file then just loading it's contents when you start up again?
 
  • #4
jackmell said:
How about saving the results to a file then just loading it's contents when you start up again?

Bill Simpson thanks for your comments.

jackmell i do not know how to do that.

however i think i should define the results of computation in new variables.
for example if after a computation i obtain a matrix i define it for another variable.
 
  • #5
Try Put and Get although if it's a lot of data, might be slow:

mymatrix = {{1, 2}, {3, 4}};
Put[mymatrix, "myfile.dat"]
fromfile = Get["myfile.dat"]

There are also other file operations to use to save and retrieve data. Look into them with the help function.
 
  • #6
A better solution is to use Save and Get. After doing the heavy calculation, you have the new matrix - suppose it is called M. Use

Save["MyMatrix.m",M]

The next time you run the notebook, add:
Get["MyMatrix.m"]

The matrix will be loaded without having to recalculate. You can save multiple objects:

Save["MyStuff.m",{M,N,P,Q,R}]
 

Related to Running simultaneous computation in mathematica

1. What is the purpose of running simultaneous computation in Mathematica?

The purpose of running simultaneous computation in Mathematica is to improve the efficiency and speed of calculations. By utilizing multiple processors or cores, different parts of a computation can be run simultaneously, reducing the overall time it takes to complete a task.

2. How do I set up and run simultaneous computation in Mathematica?

To set up and run simultaneous computation in Mathematica, you can use the Parallel Computing Toolkit, which is included in the software. This toolkit provides functions and commands for creating and managing parallel computations.

3. Can I run any type of computation simultaneously in Mathematica?

Yes, you can run various types of computations simultaneously in Mathematica, including numerical calculations, symbolic computations, and data analysis. However, the effectiveness of parallel computing may vary depending on the task and the hardware being used.

4. How does Mathematica handle data dependencies in simultaneous computations?

Mathematica has built-in algorithms that analyze and manage data dependencies in parallel computations. This ensures that data is synchronized and consistent across all processors, even if different parts of the computation are being run simultaneously.

5. Are there any limitations or considerations when using simultaneous computation in Mathematica?

There are a few limitations to keep in mind when using simultaneous computation in Mathematica. First, not all tasks may benefit from parallel computing, and some may even run slower. Additionally, there may be memory limitations or conflicts if the computation requires a large amount of data. It is also important to properly manage and monitor the parallel processes to avoid any errors or inefficiencies.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
994
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
29
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
8K
Back
Top