Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias WEBER
hercules
Commits
3fe507fd
Commit
3fe507fd
authored
4 years ago
by
Tobias WEBER
Browse files
Options
Downloads
Patches
Plain Diff
small demo run script for tutorial 5
parent
ef43d14b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-19
1 addition, 19 deletions
.gitignore
mcstas/run_tut5.sh
+89
-0
89 additions, 0 deletions
mcstas/run_tut5.sh
with
90 additions
and
19 deletions
.gitignore
+
1
−
19
View file @
3fe507fd
...
...
@@ -16,9 +16,6 @@
*.so
*.dylib
*.dll
!libs/tl2jl.dylib
!tools/test/jl/tl2jl.dylib
!tools/test/jl/tl2jl.so
# Fortran module files
*.mod
...
...
@@ -34,31 +31,16 @@
*.exe
*.out
*.app
# External libraries
ext/**
plugins/**
!ext/.dir
!plugins/.dir
!plugins/qtas.py
*.bin
# Temporary files
tmp/**
!tmp/.dir
build/**
tools/structfact/build/**
tools/magstructfact/build/**
tools/magsgbrowser/build/**
tools/pol/build/**
*.pyc
.DS_Store
*.csv
# Temporary lexer/parser files
cliparser_impl.*
clilexer_impl.*
stack.hh
# Temporary tex files
*.log
*.aux
...
...
This diff is collapsed.
Click to expand it.
mcstas/run_tut5.sh
0 → 100755
+
89
−
0
View file @
3fe507fd
#!/bin/bash
#
# @author Tobias Weber <tweber@ill.fr>
# @date mar-21
# @license GPLv3, see 'LICENSE' file
#
# number of neutrons
num_neutrons
=
1e8
# compile and run the simulation
run_compilers
=
1
run_simulations
=
1
# number of processes
hw_processes
=
$(
nproc
)
let
num_processes
=
${
hw_processes
}
-1
# tools
MCSTAS_COMP
=
$(
which mcstas
)
MPI_COMP
=
$(
which mpicc
)
MPI_RUN
=
$(
which mpirun
)
INSTR_FILE
=
"Tut5_Reso.instr"
C_FILE
=
"
${
INSTR_FILE
%.instr
}
.c"
BIN_FILE
=
"
${
INSTR_FILE
%.instr
}
.bin"
OUT_DIR
=
"Tut5_sim"
# use default number of processes if automatic determination failed
if
[
"
${
num_processes
}
"
=
""
]
;
then
num_processes
=
4
fi
# check if the compilers could be found
if
[
"
${
MCSTAS_COMP
}
"
=
""
]
||
[
"
${
MPI_COMP
}
"
=
""
]
||
[
"
${
MPI_RUN
}
"
=
""
]
;
then
echo
-e
"McStas or MPI compilers could not be found."
exit
-1
fi
# compile the simulation
if
[
"
$run_compilers
"
!=
0
]
;
then
# cleanup previous files
rm
-fv
${
C_FILE
}
rm
-fv
${
BIN_FILE
}
echo
-e
"
\n
================================================================================"
echo
-e
"Compiling
${
INSTR_FILE
}
->
${
C_FILE
}
."
echo
-e
"================================================================================"
if
!
${
MCSTAS_COMP
}
--verbose
-o
${
C_FILE
}
${
INSTR_FILE
}
;
then
echo
-e
"Failed compiling instrument file."
exit
-1
fi
echo
-e
"
\n
================================================================================"
echo
-e
"Compiling
${
C_FILE
}
->
${
BIN_FILE
}
."
echo
-e
"================================================================================"
if
!
${
MPI_COMP
}
-march
=
native
-O2
-time
-DUSE_MPI
-o
${
BIN_FILE
}
${
C_FILE
}
-lm
;
then
echo
-e
"Failed compiling C file."
exit
-1
fi
fi
# run the simulation
if
[
"
$run_simulations
"
!=
0
]
;
then
# cleanup output directory
rm
-rfv
${
OUT_DIR
}
echo
-e
"
\n
================================================================================"
echo
-e
"Running simulation
${
BIN_FILE
}
, directory:
${
OUT_DIR
}
, number of processes:
${
num_processes
}
."
echo
-e
"================================================================================"
# non-mpi call would be:
# mcrun --ncount=${num_neutrons} --dir=${OUT_DIR} ${INSTR_FILE}
if
!
${
MPI_RUN
}
--use-hwthread-cpus
-v
-np
${
num_processes
}
${
BIN_FILE
}
\
--ncount
=
${
num_neutrons
}
--format
=
McStas
--dir
=
${
OUT_DIR
}
\
src_lam
=
4.5
then
echo
-e
"Simulation failed."
exit
-1
fi
# show results
python3 ../tascalc/cov.py
"
${
OUT_DIR
}
/reso.dat"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment