Merge branch 'env-reporting' into 'development'
adjusting env reporting See merge request damask/DAMASK!375
This commit is contained in:
commit
c78b352956
|
@ -30,7 +30,6 @@ PATH=${DAMASK_ROOT}/bin:$PATH
|
||||||
SOLVER=$(type -p DAMASK_grid || true 2>/dev/null)
|
SOLVER=$(type -p DAMASK_grid || true 2>/dev/null)
|
||||||
[ "x$SOLVER" == "x" ] && SOLVER=$(blink 'Not found!')
|
[ "x$SOLVER" == "x" ] && SOLVER=$(blink 'Not found!')
|
||||||
|
|
||||||
[ "x$OMP_NUM_THREADS" == "x" ] && OMP_NUM_THREADS=1
|
|
||||||
|
|
||||||
# currently, there is no information that unlimited stack size causes problems
|
# currently, there is no information that unlimited stack size causes problems
|
||||||
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
||||||
|
@ -55,9 +54,8 @@ if [ ! -z "$PS1" ]; then
|
||||||
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
||||||
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
||||||
fi
|
fi
|
||||||
echo -n "MSC.Marc/Mentat "
|
[ "x$PETSC_ARCH" != "x" ] && echo "PETSc architecture $PETSC_ARCH"
|
||||||
[ -d $MSC_ROOT ] && echo $MSC_ROOT || blink $MSC_ROOT
|
[ "x$OMP_NUM_THREADS" == "x" ] && export OMP_NUM_THREADS=4
|
||||||
echo
|
|
||||||
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||||
echo -n "heap size "
|
echo -n "heap size "
|
||||||
[[ "$(ulimit -d)" == "unlimited" ]] \
|
[[ "$(ulimit -d)" == "unlimited" ]] \
|
||||||
|
|
|
@ -20,7 +20,6 @@ PATH=${DAMASK_ROOT}/bin:$PATH
|
||||||
SOLVER=$(which DAMASK_grid || true 2>/dev/null)
|
SOLVER=$(which DAMASK_grid || true 2>/dev/null)
|
||||||
[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!')
|
[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!')
|
||||||
|
|
||||||
[[ "x$OMP_NUM_THREADS" == "x" ]] && OMP_NUM_THREADS=1
|
|
||||||
|
|
||||||
# currently, there is no information that unlimited stack size causes problems
|
# currently, there is no information that unlimited stack size causes problems
|
||||||
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
# still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it
|
||||||
|
@ -45,11 +44,8 @@ if [ ! -z "$PS1" ]; then
|
||||||
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
[[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \
|
||||||
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
||||||
fi
|
fi
|
||||||
[[ "x$PETSC_ARCH" == "x" ]] \
|
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
||||||
|| echo "PETSc architecture $PETSC_ARCH"
|
[[ "x$OMP_NUM_THREADS" == "x" ]] && export OMP_NUM_THREADS=4
|
||||||
echo -n "MSC.Marc/Mentat "
|
|
||||||
[ -d $MSC_ROOT ] && echo $MSC_ROOT || blink $MSC_ROOT
|
|
||||||
echo
|
|
||||||
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||||
echo -n "heap size "
|
echo -n "heap size "
|
||||||
[[ "$(ulimit -d)" == "unlimited" ]] \
|
[[ "$(ulimit -d)" == "unlimited" ]] \
|
||||||
|
|
|
@ -7,6 +7,11 @@ from pathlib import Path
|
||||||
|
|
||||||
import damask
|
import damask
|
||||||
|
|
||||||
|
def copy_and_replace(in_file,dst,msc_root,editor):
|
||||||
|
with open(in_file) as f_in, open(dst/Path(in_file).name,'w') as f_out:
|
||||||
|
f_out.write(f_in.read().replace('%INSTALLDIR%',msc_root).replace('%EDITOR%',editor))
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
||||||
prog = Path(__file__).name,
|
prog = Path(__file__).name,
|
||||||
|
@ -17,34 +22,25 @@ parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
|
||||||
parser.add_argument('--msc-root', dest='msc_root', metavar='string',
|
parser.add_argument('--msc-root', dest='msc_root', metavar='string',
|
||||||
default=damask.solver._marc._msc_root,
|
default=damask.solver._marc._msc_root,
|
||||||
help='MSC.Marc/Mentat root directory')
|
help='MSC.Marc/Mentat root directory')
|
||||||
parser.add_argument('--msc-version', dest='msc_version', metavar='string',
|
parser.add_argument('--msc-version', dest='msc_version', type=float, metavar='float',
|
||||||
default=damask.solver._marc._msc_version,
|
default=damask.solver._marc._msc_version,
|
||||||
help='MSC.Marc/Mentat version')
|
help='MSC.Marc/Mentat version')
|
||||||
parser.add_argument('--damask-root', dest='damask_root', type=float, metavar = 'float',
|
parser.add_argument('--damask-root', dest='damask_root', metavar = 'string',
|
||||||
default=damask.solver._marc._damask_root,
|
default=damask.solver._marc._damask_root,
|
||||||
help='DAMASK root directory')
|
help='DAMASK root directory')
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
msc_root = Path(args.msc_root)
|
msc_root = Path(args.msc_root)
|
||||||
damask_root = Path(args.damask_root)
|
damask_root = Path(args.damask_root)
|
||||||
msc_version = args.msc_version
|
msc_version = args.msc_version
|
||||||
|
|
||||||
def copy_and_replace(in_file,dst):
|
|
||||||
with open(in_file) as f:
|
|
||||||
content = f.read()
|
|
||||||
content = content.replace('%INSTALLDIR%',str(msc_root))
|
|
||||||
content = content.replace('%EDITOR%', args.editor)
|
|
||||||
with open(dst/Path(in_file).name,'w') as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
|
|
||||||
print('adapting Marc tools...\n')
|
print('adapting Marc tools...\n')
|
||||||
|
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Marc_tools'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Marc_tools'
|
||||||
dst = msc_root/f'marc{msc_version}/tools'
|
dst = msc_root/f'marc{msc_version}/tools'
|
||||||
for in_file in glob.glob(str(src/'*damask*')) + [str(src/'include_linux64')]:
|
for in_file in glob.glob(str(src/'*damask*')) + [str(src/'include_linux64')]:
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst,args.msc_root,args.editor)
|
||||||
|
|
||||||
|
|
||||||
print('adapting Mentat scripts and menus...\n')
|
print('adapting Mentat scripts and menus...\n')
|
||||||
|
@ -52,12 +48,12 @@ print('adapting Mentat scripts and menus...\n')
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_bin'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_bin'
|
||||||
dst = msc_root/f'mentat{msc_version}/bin'
|
dst = msc_root/f'mentat{msc_version}/bin'
|
||||||
for in_file in glob.glob(str(src/'*[!.original]')):
|
for in_file in glob.glob(str(src/'*[!.original]')):
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst,args.msc_root,args.editor)
|
||||||
|
|
||||||
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_menus'
|
src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_menus'
|
||||||
dst = msc_root/f'mentat{msc_version}/menus'
|
dst = msc_root/f'mentat{msc_version}/menus'
|
||||||
for in_file in glob.glob(str(src/'job_run.ms')):
|
for in_file in glob.glob(str(src/'job_run.ms')):
|
||||||
copy_and_replace(in_file,dst)
|
copy_and_replace(in_file,dst,args.msc_root,args.editor)
|
||||||
|
|
||||||
|
|
||||||
print('compiling Mentat menu binaries...')
|
print('compiling Mentat menu binaries...')
|
||||||
|
|
|
@ -392,7 +392,7 @@ class Grid:
|
||||||
seeds_p = seeds
|
seeds_p = seeds
|
||||||
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
||||||
|
|
||||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',1)))
|
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',4)))
|
||||||
result = pool.map_async(partial(Grid._find_closest_seed,seeds_p,weights_p), [coord for coord in coords])
|
result = pool.map_async(partial(Grid._find_closest_seed,seeds_p,weights_p), [coord for coord in coords])
|
||||||
pool.close()
|
pool.close()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
@ -436,8 +436,12 @@ class Grid:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
||||||
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
|
tree = spatial.cKDTree(seeds,boxsize=size) if periodic else \
|
||||||
devNull,material_ = KDTree.query(coords)
|
spatial.cKDTree(seeds)
|
||||||
|
try:
|
||||||
|
material_ = tree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))[1]
|
||||||
|
except TypeError:
|
||||||
|
material_ = tree.query(coords, n_jobs = int(os.environ.get('OMP_NUM_THREADS',4)))[1] # scipy <1.6
|
||||||
|
|
||||||
return Grid(material = (material_ if material is None else material[material_]).reshape(cells),
|
return Grid(material = (material_ if material is None else material[material_]).reshape(cells),
|
||||||
size = size,
|
size = size,
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ class Result:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
chunk_size = 1024**2//8
|
chunk_size = 1024**2//8
|
||||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',1)))
|
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',4)))
|
||||||
lock = mp.Manager().Lock()
|
lock = mp.Manager().Lock()
|
||||||
|
|
||||||
groups = []
|
groups = []
|
||||||
|
|
|
@ -78,7 +78,7 @@ def from_Poisson_disc(size,N_seeds,N_candidates,distance,periodic=True,rng_seed=
|
||||||
candidates = rng.random((N_candidates,3))*_np.broadcast_to(size,(N_candidates,3))
|
candidates = rng.random((N_candidates,3))*_np.broadcast_to(size,(N_candidates,3))
|
||||||
tree = _spatial.cKDTree(coords[:s],boxsize=size) if periodic else \
|
tree = _spatial.cKDTree(coords[:s],boxsize=size) if periodic else \
|
||||||
_spatial.cKDTree(coords[:s])
|
_spatial.cKDTree(coords[:s])
|
||||||
distances, dev_null = tree.query(candidates)
|
distances = tree.query(candidates)[0]
|
||||||
best = distances.argmax()
|
best = distances.argmax()
|
||||||
if distances[best] > distance: # require minimum separation
|
if distances[best] > distance: # require minimum separation
|
||||||
coords[s] = candidates[best] # maximum separation to existing point cloud
|
coords[s] = candidates[best] # maximum separation to existing point cloud
|
||||||
|
|
Loading…
Reference in New Issue