a = 0;
for i = 1:1000
a = a+i;
end
+
- * .* & | [,] [;] {,} {;} min max union intersect
。*
[] {}
底层有特殊处理保证结果的正确性。a[i]
a[i+1]
同时出现则a不被识别为切片变量。tmp = 5;
broadcast = 1;
reduced = 0;
sliced = ones(1, 10);
parfor i = 1:10
tmp = i;
reduced = reduced + i + broadcast;
sliced(i) = sliced(i) * i;
end
matlabpool
n
命令可以打开n个worker。matlabpool
open configname
按照指定配置打开,默认配置为local
。matlabpool
close
关闭worker。Parallel
-> Manage Cluster Profile
完成。c-1
。对于计算密集型程序,超线程带来的性能提升几乎为0,可以设置为核心数,而不是线程数。
Matlab的parfor并行编程,布布扣,bubuko.com
原文地址:http://blog.csdn.net/caozhk/article/details/38234293