Parallel Computing Problem












2












$begingroup$


The program runs out quickly(30 seconds) if I don't do parallel.But when I replace Table with ParallelTable,the Program will keep running,no output results.



My code
https://privatebin.net/?d1b1eeff435720eb#XWLsW2gY2EfTFnX+eQCXtCVBPN4budq3wQtVWaNwI4g=










share|improve this question









$endgroup$

















    2












    $begingroup$


    The program runs out quickly(30 seconds) if I don't do parallel.But when I replace Table with ParallelTable,the Program will keep running,no output results.



    My code
    https://privatebin.net/?d1b1eeff435720eb#XWLsW2gY2EfTFnX+eQCXtCVBPN4budq3wQtVWaNwI4g=










    share|improve this question









    $endgroup$















      2












      2








      2


      1



      $begingroup$


      The program runs out quickly(30 seconds) if I don't do parallel.But when I replace Table with ParallelTable,the Program will keep running,no output results.



      My code
      https://privatebin.net/?d1b1eeff435720eb#XWLsW2gY2EfTFnX+eQCXtCVBPN4budq3wQtVWaNwI4g=










      share|improve this question









      $endgroup$




      The program runs out quickly(30 seconds) if I don't do parallel.But when I replace Table with ParallelTable,the Program will keep running,no output results.



      My code
      https://privatebin.net/?d1b1eeff435720eb#XWLsW2gY2EfTFnX+eQCXtCVBPN4budq3wQtVWaNwI4g=







      parallelization






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 23 hours ago









      guangyaguangya

      192




      192






















          2 Answers
          2






          active

          oldest

          votes


















          3












          $begingroup$

          Replace your t' with anything legal, e.g. tp will solve the problem. Assigning t' is actually doing Derivative[1][t]=1, which is not advisable.



          The reason of this strange behavior is that SubValues of derivative is not automatically distributed to kernels. Therefore you get 1'==0.6 for the main kernel, and 1'==0& for the sub kernels, and the value of this constant becomes a function which fails the later calculation.



          After making such replacement, and deleting the duplicated ParallelTable in your F definition, you can get the expected result:



          ParallelTable[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
          {4.8858, Null}
          Table[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
          {8.10208, Null}





          share|improve this answer











          $endgroup$





















            2












            $begingroup$

            Two things will provide for immense speed-up with parallel functions like ParallelTable:





            1. Launch your kernels ahead of the initial parallel call with:



              LaunchKernels["Number of Kernels, max available if left blank"]



            2. Ensure each kernel has prior knowledge of the functions with:



              DistributeDefinitions["context`"]



            You should also see some increase in speed, due to a decrease in CPU need, if you were to provide assumptions for all of your defined variable functions. What I mean by this is something like:



                f[x_?NumericQ,n_?IntegerQ]


            Wherein x is always a numerical input and n is an integer.



            I hope this helps you understand how to run parallel code better, it's a constant learning process, as we will continue to make more and more efficient ways that leave the previous best methods in the dust, and we will have to keep up :D



            So, after discussing with @happy fish, I was able to test the code, and got this output, after replacing the second ParallelTable with Table:



                {-0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029}


            There is something amiss with this, and I apologize that I cannot immediately parse what the issue is. I will take some time to check later and see if I can provide additional input, after satisfying my own duties prior ;) As for the rest:



            The issue with using two ParallelTable calls is why you would not receive output for your addition of Parallel to the second Table, again, barring my lack of understanding. Additionally, you would assuredly benefit from a functional method of implementing this code. There are numerous inline reassignments which can likely be shortened, and I anticipate that is another issue imparting itself upon your long-running/non-functional parallel implementation.






            share|improve this answer











            $endgroup$









            • 2




              $begingroup$
              Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
              $endgroup$
              – happy fish
              20 hours ago










            • $begingroup$
              @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
              $endgroup$
              – CA Trevillian
              20 hours ago






            • 1




              $begingroup$
              I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
              $endgroup$
              – happy fish
              20 hours ago






            • 1




              $begingroup$
              Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
              $endgroup$
              – guangya
              16 hours ago






            • 1




              $begingroup$
              we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
              $endgroup$
              – guangya
              16 hours ago












            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "387"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195571%2fparallel-computing-problem%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$

            Replace your t' with anything legal, e.g. tp will solve the problem. Assigning t' is actually doing Derivative[1][t]=1, which is not advisable.



            The reason of this strange behavior is that SubValues of derivative is not automatically distributed to kernels. Therefore you get 1'==0.6 for the main kernel, and 1'==0& for the sub kernels, and the value of this constant becomes a function which fails the later calculation.



            After making such replacement, and deleting the duplicated ParallelTable in your F definition, you can get the expected result:



            ParallelTable[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
            {4.8858, Null}
            Table[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
            {8.10208, Null}





            share|improve this answer











            $endgroup$


















              3












              $begingroup$

              Replace your t' with anything legal, e.g. tp will solve the problem. Assigning t' is actually doing Derivative[1][t]=1, which is not advisable.



              The reason of this strange behavior is that SubValues of derivative is not automatically distributed to kernels. Therefore you get 1'==0.6 for the main kernel, and 1'==0& for the sub kernels, and the value of this constant becomes a function which fails the later calculation.



              After making such replacement, and deleting the duplicated ParallelTable in your F definition, you can get the expected result:



              ParallelTable[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
              {4.8858, Null}
              Table[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
              {8.10208, Null}





              share|improve this answer











              $endgroup$
















                3












                3








                3





                $begingroup$

                Replace your t' with anything legal, e.g. tp will solve the problem. Assigning t' is actually doing Derivative[1][t]=1, which is not advisable.



                The reason of this strange behavior is that SubValues of derivative is not automatically distributed to kernels. Therefore you get 1'==0.6 for the main kernel, and 1'==0& for the sub kernels, and the value of this constant becomes a function which fails the later calculation.



                After making such replacement, and deleting the duplicated ParallelTable in your F definition, you can get the expected result:



                ParallelTable[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
                {4.8858, Null}
                Table[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
                {8.10208, Null}





                share|improve this answer











                $endgroup$



                Replace your t' with anything legal, e.g. tp will solve the problem. Assigning t' is actually doing Derivative[1][t]=1, which is not advisable.



                The reason of this strange behavior is that SubValues of derivative is not automatically distributed to kernels. Therefore you get 1'==0.6 for the main kernel, and 1'==0& for the sub kernels, and the value of this constant becomes a function which fails the later calculation.



                After making such replacement, and deleting the duplicated ParallelTable in your F definition, you can get the expected result:



                ParallelTable[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
                {4.8858, Null}
                Table[F[0, 0, k], {k, 1, 10}]; // AbsoluteTiming
                {8.10208, Null}






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 18 hours ago

























                answered 18 hours ago









                happy fishhappy fish

                5,57121546




                5,57121546























                    2












                    $begingroup$

                    Two things will provide for immense speed-up with parallel functions like ParallelTable:





                    1. Launch your kernels ahead of the initial parallel call with:



                      LaunchKernels["Number of Kernels, max available if left blank"]



                    2. Ensure each kernel has prior knowledge of the functions with:



                      DistributeDefinitions["context`"]



                    You should also see some increase in speed, due to a decrease in CPU need, if you were to provide assumptions for all of your defined variable functions. What I mean by this is something like:



                        f[x_?NumericQ,n_?IntegerQ]


                    Wherein x is always a numerical input and n is an integer.



                    I hope this helps you understand how to run parallel code better, it's a constant learning process, as we will continue to make more and more efficient ways that leave the previous best methods in the dust, and we will have to keep up :D



                    So, after discussing with @happy fish, I was able to test the code, and got this output, after replacing the second ParallelTable with Table:



                        {-0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029}


                    There is something amiss with this, and I apologize that I cannot immediately parse what the issue is. I will take some time to check later and see if I can provide additional input, after satisfying my own duties prior ;) As for the rest:



                    The issue with using two ParallelTable calls is why you would not receive output for your addition of Parallel to the second Table, again, barring my lack of understanding. Additionally, you would assuredly benefit from a functional method of implementing this code. There are numerous inline reassignments which can likely be shortened, and I anticipate that is another issue imparting itself upon your long-running/non-functional parallel implementation.






                    share|improve this answer











                    $endgroup$









                    • 2




                      $begingroup$
                      Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                      $endgroup$
                      – happy fish
                      20 hours ago










                    • $begingroup$
                      @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                      $endgroup$
                      – CA Trevillian
                      20 hours ago






                    • 1




                      $begingroup$
                      I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                      $endgroup$
                      – happy fish
                      20 hours ago






                    • 1




                      $begingroup$
                      Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                      $endgroup$
                      – guangya
                      16 hours ago






                    • 1




                      $begingroup$
                      we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                      $endgroup$
                      – guangya
                      16 hours ago
















                    2












                    $begingroup$

                    Two things will provide for immense speed-up with parallel functions like ParallelTable:





                    1. Launch your kernels ahead of the initial parallel call with:



                      LaunchKernels["Number of Kernels, max available if left blank"]



                    2. Ensure each kernel has prior knowledge of the functions with:



                      DistributeDefinitions["context`"]



                    You should also see some increase in speed, due to a decrease in CPU need, if you were to provide assumptions for all of your defined variable functions. What I mean by this is something like:



                        f[x_?NumericQ,n_?IntegerQ]


                    Wherein x is always a numerical input and n is an integer.



                    I hope this helps you understand how to run parallel code better, it's a constant learning process, as we will continue to make more and more efficient ways that leave the previous best methods in the dust, and we will have to keep up :D



                    So, after discussing with @happy fish, I was able to test the code, and got this output, after replacing the second ParallelTable with Table:



                        {-0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029}


                    There is something amiss with this, and I apologize that I cannot immediately parse what the issue is. I will take some time to check later and see if I can provide additional input, after satisfying my own duties prior ;) As for the rest:



                    The issue with using two ParallelTable calls is why you would not receive output for your addition of Parallel to the second Table, again, barring my lack of understanding. Additionally, you would assuredly benefit from a functional method of implementing this code. There are numerous inline reassignments which can likely be shortened, and I anticipate that is another issue imparting itself upon your long-running/non-functional parallel implementation.






                    share|improve this answer











                    $endgroup$









                    • 2




                      $begingroup$
                      Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                      $endgroup$
                      – happy fish
                      20 hours ago










                    • $begingroup$
                      @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                      $endgroup$
                      – CA Trevillian
                      20 hours ago






                    • 1




                      $begingroup$
                      I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                      $endgroup$
                      – happy fish
                      20 hours ago






                    • 1




                      $begingroup$
                      Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                      $endgroup$
                      – guangya
                      16 hours ago






                    • 1




                      $begingroup$
                      we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                      $endgroup$
                      – guangya
                      16 hours ago














                    2












                    2








                    2





                    $begingroup$

                    Two things will provide for immense speed-up with parallel functions like ParallelTable:





                    1. Launch your kernels ahead of the initial parallel call with:



                      LaunchKernels["Number of Kernels, max available if left blank"]



                    2. Ensure each kernel has prior knowledge of the functions with:



                      DistributeDefinitions["context`"]



                    You should also see some increase in speed, due to a decrease in CPU need, if you were to provide assumptions for all of your defined variable functions. What I mean by this is something like:



                        f[x_?NumericQ,n_?IntegerQ]


                    Wherein x is always a numerical input and n is an integer.



                    I hope this helps you understand how to run parallel code better, it's a constant learning process, as we will continue to make more and more efficient ways that leave the previous best methods in the dust, and we will have to keep up :D



                    So, after discussing with @happy fish, I was able to test the code, and got this output, after replacing the second ParallelTable with Table:



                        {-0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029}


                    There is something amiss with this, and I apologize that I cannot immediately parse what the issue is. I will take some time to check later and see if I can provide additional input, after satisfying my own duties prior ;) As for the rest:



                    The issue with using two ParallelTable calls is why you would not receive output for your addition of Parallel to the second Table, again, barring my lack of understanding. Additionally, you would assuredly benefit from a functional method of implementing this code. There are numerous inline reassignments which can likely be shortened, and I anticipate that is another issue imparting itself upon your long-running/non-functional parallel implementation.






                    share|improve this answer











                    $endgroup$



                    Two things will provide for immense speed-up with parallel functions like ParallelTable:





                    1. Launch your kernels ahead of the initial parallel call with:



                      LaunchKernels["Number of Kernels, max available if left blank"]



                    2. Ensure each kernel has prior knowledge of the functions with:



                      DistributeDefinitions["context`"]



                    You should also see some increase in speed, due to a decrease in CPU need, if you were to provide assumptions for all of your defined variable functions. What I mean by this is something like:



                        f[x_?NumericQ,n_?IntegerQ]


                    Wherein x is always a numerical input and n is an integer.



                    I hope this helps you understand how to run parallel code better, it's a constant learning process, as we will continue to make more and more efficient ways that leave the previous best methods in the dust, and we will have to keep up :D



                    So, after discussing with @happy fish, I was able to test the code, and got this output, after replacing the second ParallelTable with Table:



                        {-0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029, -0.463029}


                    There is something amiss with this, and I apologize that I cannot immediately parse what the issue is. I will take some time to check later and see if I can provide additional input, after satisfying my own duties prior ;) As for the rest:



                    The issue with using two ParallelTable calls is why you would not receive output for your addition of Parallel to the second Table, again, barring my lack of understanding. Additionally, you would assuredly benefit from a functional method of implementing this code. There are numerous inline reassignments which can likely be shortened, and I anticipate that is another issue imparting itself upon your long-running/non-functional parallel implementation.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 19 hours ago

























                    answered 21 hours ago









                    CA TrevillianCA Trevillian

                    538




                    538








                    • 2




                      $begingroup$
                      Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                      $endgroup$
                      – happy fish
                      20 hours ago










                    • $begingroup$
                      @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                      $endgroup$
                      – CA Trevillian
                      20 hours ago






                    • 1




                      $begingroup$
                      I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                      $endgroup$
                      – happy fish
                      20 hours ago






                    • 1




                      $begingroup$
                      Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                      $endgroup$
                      – guangya
                      16 hours ago






                    • 1




                      $begingroup$
                      we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                      $endgroup$
                      – guangya
                      16 hours ago














                    • 2




                      $begingroup$
                      Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                      $endgroup$
                      – happy fish
                      20 hours ago










                    • $begingroup$
                      @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                      $endgroup$
                      – CA Trevillian
                      20 hours ago






                    • 1




                      $begingroup$
                      I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                      $endgroup$
                      – happy fish
                      20 hours ago






                    • 1




                      $begingroup$
                      Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                      $endgroup$
                      – guangya
                      16 hours ago






                    • 1




                      $begingroup$
                      we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                      $endgroup$
                      – guangya
                      16 hours ago








                    2




                    2




                    $begingroup$
                    Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                    $endgroup$
                    – happy fish
                    20 hours ago




                    $begingroup$
                    Thanks for your answer, but I don't think it addresses the problem OP encountered. LaunchKernels and DistributeDefinitions are done automatically, there is no need of explicitly writing down. There won't be an "immense speed-up with parallel functions" in either case. Testing the parameter can avoid unnecessary symbolic computations, but won't help here since everything is numerical.
                    $endgroup$
                    – happy fish
                    20 hours ago












                    $begingroup$
                    @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                    $endgroup$
                    – CA Trevillian
                    20 hours ago




                    $begingroup$
                    @happyfish I'm not sure that is entirely accurate, unfortunately. Though it would be nice! My understanding is as follows: When you perform the first call on a parallel function, you will spend more time than subsequent calls, this being due to the need to launch all kernels. Additionally there is some time taken to distribute definitions, if this is indeed done automatically. I am curious if there is a part of the documentation you can point to for this? I am unable to have ParallelTable actually use all kernels unless you have done as I stated, otherwise they take about a second longer.
                    $endgroup$
                    – CA Trevillian
                    20 hours ago




                    1




                    1




                    $begingroup$
                    I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                    $endgroup$
                    – happy fish
                    20 hours ago




                    $begingroup$
                    I agree with your general ideas on parallel evaluations. I am just saying that these theories don't localize for this particular problem. If you experiment on the problem you will find immediately that the bottleneck is not on where you focus: it's just distributing 10 difficult tasks to 6(by default) kernels, the overhead of subsequent calls and copying definitions is negligible. For the automatically distribute definition part, please refer to the first example in Options->DistributedContexts and mathematica.stackexchange.com/questions/39178/…
                    $endgroup$
                    – happy fish
                    20 hours ago




                    1




                    1




                    $begingroup$
                    Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                    $endgroup$
                    – guangya
                    16 hours ago




                    $begingroup$
                    Condensed matter physics.Bott index,is a kind of Chern number@CATrevillian
                    $endgroup$
                    – guangya
                    16 hours ago




                    1




                    1




                    $begingroup$
                    we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                    $endgroup$
                    – guangya
                    16 hours ago




                    $begingroup$
                    we use it to judge whether a substance is trivial topology or not@CATrevillian. Nobel Prize in 2016
                    $endgroup$
                    – guangya
                    16 hours ago


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematica Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195571%2fparallel-computing-problem%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How did Captain America manage to do this?

                    迪纳利

                    南乌拉尔铁路局