mirror of
https://github.com/Lukas0025/POC1-SIMD-DNA.git
synced 2025-04-04 06:41:35 +01:00
Added support for parallel compute
This commit is contained in:
parent
3c6db0bbb5
commit
2271a01e68
@ -29,9 +29,6 @@ class Register:
|
||||
#
|
||||
def instruction(self, IMols):
|
||||
# @todo: while chainging
|
||||
Parallel(n_jobs=4)(delayed(self.insDo)(IMols) for _ in range(4))
|
||||
|
||||
def insDo(self, IMols):
|
||||
for _ in range(20):
|
||||
for mol in IMols:
|
||||
# try bind mol to all possible bindings
|
||||
@ -59,6 +56,9 @@ class Register:
|
||||
# remove all unstable binded chains binded on 1 base or lower
|
||||
self.removeUnstable()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
##
|
||||
# remove unbinded chains from register (because new imol have bind on more posisin on register that older)
|
||||
# --
|
||||
|
10
src/main.py
10
src/main.py
@ -5,6 +5,8 @@ from SIMDDNA.assembly import Assembly
|
||||
from SIMDDNA.ascii import showMolecule
|
||||
import argparse
|
||||
|
||||
from joblib import Parallel, delayed
|
||||
|
||||
parser = argparse.ArgumentParser(description='DNA|SIMD python simulator POC1')
|
||||
parser.add_argument('assembly')
|
||||
parser.add_argument('-s', '--spaceing', default=" ", help='space sentense between ascii char of DNA strands')
|
||||
@ -57,10 +59,10 @@ for ins in asm.getInstructions():
|
||||
print("--------------------------------")
|
||||
print()
|
||||
|
||||
for reg in regs:
|
||||
reg.instruction(ins["ins"])
|
||||
|
||||
if args.verbose:
|
||||
regs = Parallel(n_jobs=max(len(regs), 4))(delayed(reg.instruction)(ins["ins"]) for reg in regs)
|
||||
|
||||
if args.verbose:
|
||||
for reg in regs:
|
||||
reg.asciiShow(spaceing = args.spaceing)
|
||||
print("")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user