How to use parallel 'for' loop in Octave or Scilab?

前端 未结 4 816
迷失自我
迷失自我 2020-12-19 06:36

I have two for loops running in my Matlab code. The inner loop is parallelized using Matlabpool in 12 processors (which is maximum Matlab allows in a single machine).

4条回答
  •  旧时难觅i
    2020-12-19 07:11

    In Scilab you can use parallel_run:

    function a=g(arg1)
      a=arg1*arg1
    endfunction
    
    res=parallel_run(1:10, g);
    

    Limitations

    • uses only one core on Windows platforms.
    • For now, parallel_run only handles arguments and results of scalar matrices of real values and the types argument is not used
    • one should not rely on side effects such as modifying variables from outer scope : only the data stored into the result variables will be copied back into the calling environment.
    • macros called by parallel_run are not allowed to use the JVM
    • no stack resizing (via gstacksize() or via stacksize()) should take place during a call to parallel_run

提交回复
热议问题