I am new to mathematica and have the following question regarding parallelization of the code. I have an input data which is of the form

data = Import["data.dat", "Table"]

Then I create a module which executes various line of code and then use the module to do the following.

Table[module[data[[i]]], {i, 1, 10}]

This works perfectly fine the only problem is that it takes a lot of time close to 15 minutes as there is a differential equation which it has to execute 10 times. Then I tried ParallelTable but it does not work effectively. Thus I tried parallelising the code using ParallelSubmit as follows.

tab = ParallelSubmit[Table[module[data[[i]]], {i, 1, 3}]]

This gives me the error

Part specification data[[1]] is longer than depth of object.

This is just a sample of 10 points under consideration and in the actual sitation it may include 20 or more points.

It would be of great help if someone could help me resolve the problem.

I have made the following changes 1) Table[ParallelSubmit[module[data[[j]]]], {j, 1, 3}] I get the error

The expression j cannot be used as a part specification.


closed as off-topic by m_goldberg, MarcoB, Oleksandr R., dr.blochwave, Öskå Sep 13 '15 at 9:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – m_goldberg, Oleksandr R., dr.blochwave, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Greetings! Make the most of Mma.SE and take the tour. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, include minimum working examples of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$ – rhermans Sep 11 '15 at 16:43
  • $\begingroup$ I dont know about the error, but you should review the docs for ParallelSubmit. ParallelSubmit should be applied to the expression inside the table, not the table itself. There is a example of exactly that in the docs. $\endgroup$ – george2079 Sep 11 '15 at 16:45
  • $\begingroup$ can you please expand on " I tried ParallelTable but it does not work effectively". Share the code you tried, why didn't it work? Did you DistributeDefinitions? How big is the data? There is an overhead moving the data to other kernels. Are the other kernels remote or local? $\endgroup$ – rhermans Sep 11 '15 at 16:46
  • $\begingroup$ I have included it in the function and get the following error The expression i cannot be used as a part specification $\endgroup$ – Abhishek Subramanian Sep 11 '15 at 17:30
  • 1
    $\begingroup$ re: edit.. you must give {j} as the first arg to ParallelSubmit (as in the docs). That said, I think you should go back and figure out what was wrong with your ParallelTable implementation. (I'd use ParallelSubmit only if your module calls are wildly unbalanced ) $\endgroup$ – george2079 Sep 11 '15 at 18:01

Browse other questions tagged or ask your own question.