我有两个函数,core_ensembling和sampling.core集合返回值。我需要在采样函数内并行化core_ensebling函数。这就是我需要并行计算set1,set2,set3 ... set6.All这个计算是独立的那么可以并行化这个程序吗?。我怎么能这样做?我使用的是Windows 10,intel i3处理器,它有2个内核和python 2.7
def core_ensembling(args):
#some code#
return ensemble_set
def sampling(p,q):
total_frames=q
ensemble_row=6
ensemble_col=8
frame_ensemble=[]
ensemble_set=[]
args1=[8,0,80,total_frames,p]
args2=[16,80,160,total_frames,p]
args3=[24,160,240,total_frames,p]
args4=[32,240,320,total_frames,p]
args5=[40,320,400,total_frames,p]
args6=[48,400,480,total_frames,p]
# parallising part
set1=core_ensembling(args1)
set2=core_ensembling(args2)
set3=core_ensembling(args3)
set4=core_ensembling(args4)
set5=core_ensembling(args5)
set6=core_ensembling(args6)
ensemble = list(itertools.chain(set1,set2,set3,set4,set5,set6))
return ensemble
答案 0 :(得分:0)
<div class="row form-group product-chooser">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4" ng-repeat="product in products">
<div ng-class="{selected: isSelected}" class="product-chooser-item">
<img ng-src="{{product.product_image}}" class="img-rounded col-xs-4 col-sm-4 col-md-12 col-lg-12" alt="">
<div class="col-xs-8 col-sm-8 col-md-12 col-lg-12">
<span class="title">{{product.product_name}}</span>
<span class="description">{{product.product_desc}}</span>
<button class="btn btn-success" ng-click="addProductToCart(product); activeProduct()">Select Package</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>