|
理解并发数关键的概念
#!/usr/bin/perl
#zinc have 91G mols
#we should convert mols to pdbqts
#author: chenzhaoqiang
#date: 2015-01-20
use strict;
use warnings;
use Parallel::Runner;
my @zincs=<ZINC*mol2>; #
my $runner = Parallel::Runner->new(20); #设置并发数,会自动等待完成的,这才是多线程的思想,
my $command;
foreach my $mol(@zincs)
{
$runner->run(
sub{
$command="prepare_ligand4.py -l $mol"; #这里涉及到如果给闭包传递参数
system($command);
}
);
}
$runner->finish;
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-17 10:28
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社