Skip to content

Commit

Permalink
Merge pull request #216 from vincentcasseau/main
Browse files Browse the repository at this point in the history
KCore: manage nested dependencies. V2: chunk list of obj files in a d…
  • Loading branch information
vincentcasseau authored Nov 4, 2024
2 parents 5fd4a2f + 8c7ca26 commit d4742dc
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions Cassiopee/KCore/Dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2665,36 +2665,27 @@ def envFortranWithDeps(env, filename, deps={}):
return env.Fortran(target=target)

# Cree les noms des fichiers
def createFortranFiles(env, srcs, chunkSize=None, deps={}):
def createFortranFiles(env, srcs, deps={}):
for_srcs = []
if chunkSize is None:
try:
for_srcs.extend(srcs.for_srcs[:])
except: pass
try:
for_srcs.extend(srcs.f90_srcs[:])
except: pass
ppf = []
for f in for_srcs:
ofile = envFortranWithDeps(env=env, filename=f, deps=deps)
ppf.append(ofile[0])
else:
try:
for i in range(0, len(srcs.for_srcs), chunkSize):
for_srcs.append(srcs.for_srcs[i:i+chunkSize])
except: pass
try:
for i in range(0, len(srcs.f90_srcs), chunkSize):
for_srcs.append(srcs.f90_srcs[i:i+chunkSize])
except: pass
nchunks = len(for_srcs)
ppf = [[] for _ in range(nchunks)]
for c in range(nchunks):
for f in for_srcs[c]:
ofile = envFortranWithDeps(env=env, filename=f, deps=deps)
ppf[c].append(ofile[0])
try:
for_srcs.extend(srcs.for_srcs[:])
except: pass
try:
for_srcs.extend(srcs.f90_srcs[:])
except: pass
ppf = []
for f in for_srcs:
ofile = envFortranWithDeps(env=env, filename=f, deps=deps)
ppf.append(ofile[0])
return ppf

# Decoupe une liste de fichiers object en morceaux de taille egale a chunkSize
def chunkObjectFiles(ppf, chunkSize=100):
chunked_ppf = []
for i in range(0, len(ppf), chunkSize):
chunked_ppf.append(ppf[i:i+chunkSize])
return chunked_ppf

# Scan les .f pour faire les dependences (include)
def fortranScan(node, env, path, arg=None):
import re
Expand Down

0 comments on commit d4742dc

Please sign in to comment.