Skip to content

Commit 6ba08dd

Browse files
authored
Dev lmod support (#36)
Co-authored-by: Ole Osterthun * Support Lmod #33 RWTH switched to a different way of handling modules Change the way modules are handled, since Lmod supports proper exit codes. Therefore use them and get rid of the tmpfile debacle. * Rework guide for Lmod Issue #34 asked for support for Lmod. The reworked guide now explains how to use it. (Hopefully.) * Testing module script #34 This small script allows to test whether the modules behave like the script asserts. Mainly that is the correct exit codes when module loading fails. * Minor Fixes, #37 typo in configure #38 (rm hotfix) #41 fix xtb link * Fixes in configure script Avoid using empty variables in configure configure did not produce correct warning moved question to where it belongs #43 * Include deprecation notices for bsub #42 * fix: Allows multithreaded crest #45 and further move quickfix for #45 * there is no need for the srun ommand on a single node; removed it
1 parent 2742054 commit 6ba08dd

9 files changed

Lines changed: 346 additions & 230 deletions

File tree

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This script provides a wrapper for the
44
extended tight-binding semi-empirical program package
5-
[xtb](https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/xtb/xtb)
5+
[xtb](https://www.chemie.uni-bonn.de/grimme/de/software/xtb)
66
(version 6.0 or later) from Stefan Grimme's group at the University of Bonn
77
(contact: xtb{at}thch.uni-bonn.de).
88
It is available via [GitHub](https://github.com/grimme-lab/xtb).
@@ -24,7 +24,7 @@ Briefly:
2424
Obtain the latest version of xtb (and crest) from its
2525
[GitHub](https://github.com/grimme-lab/xtb/releases/latest) page.
2626
While you're at it, you might want to pick up crest, too. It is also available at
27-
[GithUb](https://github.com/crest-lab/crest/releases/latest).
27+
[GitHub](https://github.com/crest-lab/crest/releases/latest).
2828
Pick a directory, where you would like to install these packages, e.g.
2929
a separate user (here: software) and the root directory `/home/software/chemsoft/xtb`.
3030
Unpack the downloaded xtb archives (this may create a new directory for the downloaded version,
@@ -53,6 +53,16 @@ Alternative options (e.g. `'scriptpath'/.runxtbrc`) are also given.
5353
After that, the configuration script will ask about creating symbolic links in `~/bin`.
5454
If you choose to do that, you can basically access the script from anywhere in your file system.
5555

56+
### Using environment modules
57+
58+
This script can interface to environment modules.
59+
For the developement of this feature, [Lmod](https://lmod.readthedocs.io/) was used.
60+
61+
More details can be found in the guides directory: [guides/module-examples.md](guides/module-examples.md).
62+
63+
To check whether your supplied module system is supported, please find the script
64+
`test_modules.sh` in the [configure directory](configure) of this repository.
65+
5666
## Updating
5767

5868
If you decided to clone the repository, make sure to stash your changes,
@@ -92,10 +102,10 @@ The following script options are available:
92102
| `-o <ARG>` | Trap the output (without errors) of `xtb` into a file called `<ARG>`. (Default: `auto`)
93103
| `-s` | Write a submit script instead of interactive execution (default: PBS). Resulting file needs to be submitted.
94104
| `-S` | Write submit script and directly submit it to the queue, requires setting a queueing system with `-Q`.
95-
| `-Q <ARG>` | Set a queueing system for which the submit script should be prepared, supported `pbs-gen`, `slurm-gen`, `bsub-gen`.
105+
| `-Q <ARG>` | Set a queueing system for which the submit script should be prepared, supported `pbs-gen`, `slurm-gen`, (`bsub-gen`).
96106
| `-P <ARG>` | Account to project or account `<ARG>`, only slurm, LSF (bsub).
97107
| `-M` | Use pre-installed modules instead of path settings, also needs specified module(s).
98-
| `-l <ARG>` | Specify a module to be used, will also invoke `-M`, may be specified multiple times to create a list, `<ARG>=0` clears the list.
108+
| `-l <ARG>` | Specify a module to be used, will also invoke `-M`, may be specified multiple times to create a list, `<ARG>=purge` unloads all modules and `<ARG>=0` clears the list.
99109
| `-i` | Execute in interactive mode (default without configuration).
100110
| `-B <ARG>` | Set the absolute path to the executable `xtb` to `<ARG>`. The name of the program needs to be included.
101111
| `-C <ARG>` | Set the name of the program directly, e.g. to access a different executable like crest (if installed).
@@ -104,6 +114,8 @@ The following script options are available:
104114
| `-H` | Retrieve the man page of xtb of the original xtb distribution.
105115
| `-X` | Retrieve the man page of xcontrol of the original xtb distribution.
106116

117+
Please note that support for LSF (bsub) is now deprecated and will be removed in a future update.
118+
107119
## Included files and directories
108120

109121
The following files and/or directories come with this script:
@@ -163,4 +175,4 @@ See [LICENSE](LICENSE) to see the full text.
163175
You should have received a copy of the GNU General Public License
164176
along with this program. If not, see <https://www.gnu.org/licenses/>.
165177

166-
(Martin; 2024-01-07; wrapper version 0.5.0)
178+
(Martin; 2024-11-02; wrapper version 0.6.0)

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
version="0.5.0"
3-
versiondate="2024-01-07"
2+
version="0.6.0"
3+
versiondate="2024-11-02"

configure/configure.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ ask_callname ()
470470

471471
ask_modules ()
472472
{
473-
ask "If a modular cluster management is available, do you want to use it?"
473+
ask "If a modular path management is available, do you want to use it?"
474474
use_module_system=$(read_true_false)
475475
debug "use_module_system=$use_module_system"
476476
if [[ "$use_module_system" =~ ^[Tt]([Rr]([Uu]([Ee])?)?)?$ ]] ; then
@@ -482,6 +482,9 @@ ask_modules ()
482482
# use_module_system="false"
483483
# warning "Switching the use of modules off."
484484
fi
485+
ask "Would you like to purge pre-loaded modules?"
486+
use_purge_modules=$(read_true_false)
487+
debug "use_purge_modules=$use_purge_modules"
485488
# Unsetting read in module
486489
unset use_module_items
487490
local module_index=0
@@ -506,6 +509,12 @@ ask_modules ()
506509
else
507510
debug "No modules used."
508511
fi
512+
# Avoid empty depending variables
513+
if [[ "$use_module_system" =~ ^[Ff]([Aa]([Ll]([Ss][Ee]?)?)?)?$ ]] ; then
514+
use_purge_modules="false"
515+
debug "use_module_system=$use_module_system"
516+
debug "use_purge_modules=$use_purge_modules"
517+
fi
509518
}
510519

511520
ask_interactivity ()
@@ -518,13 +527,13 @@ ask_interactivity ()
518527
read_boolean && use_interactivity="sub"
519528
debug "use_interactivity=$use_interactivity"
520529
fi
521-
522-
ask "What queueing system would you like to use?"
523530
}
524531

525532
ask_qsys_details ()
526533
{
534+
ask "What queueing system would you like to use?"
527535
message "Currently supported: pbs-gen, bsub-gen, slurm-gen, bsub-rwth, slurm-rwth"
536+
message "Please note that support for LSF (bsub) is now deprecated and will be removed in a future update."
528537
local test_queue
529538
test_queue=$(read_human_input)
530539
debug "test_queue=$test_queue"
@@ -550,7 +559,8 @@ ask_qsys_details ()
550559
'' )
551560
: ;;
552561
* )
553-
[[ -z $use_queue ]] && warning "Unrecognised queueing system ($test_queue)"
562+
warning "Unrecognised queueing system ($test_queue)"
563+
message "Retaining recovered choice (or empty): $use_queue"
554564
;;
555565
esac
556566
debug "use_queue=$use_queue"
@@ -747,9 +757,10 @@ print_settings ()
747757

748758
echo "## Set default queueing system for which the script should be written"
749759
echo "## (pbs-gen, bsub-gen, slurm-gen, or *-rwth [special cases, see source])"
760+
echo "## Please note that support for LSF (bsub) is now deprecated and will be removed in a future update."
750761
echo "# "
751762
if [[ -z $use_queue ]] ; then
752-
echo "# request_qsys=\"bsub-rwth\""
763+
echo "# request_qsys=\"pbs-gen\""
753764
else
754765
echo " request_qsys=\"$use_queue\""
755766
fi
@@ -773,15 +784,24 @@ print_settings ()
773784
echo "#"
774785
if [[ -z $use_module_system ]] ; then
775786
echo "# use_modules=\"true\""
787+
echo "#"
788+
echo "# Allow to start fresh by allowing modules to be purged:"
789+
echo "#"
790+
echo "# purge_modules=\"true\""
791+
echo "# purge_modules=\"false\""
776792
else
777793
echo " use_modules=\"$use_module_system\""
794+
echo "#"
795+
echo "# Allow to start fresh by allowing modules to be purged:"
796+
echo "#"
797+
echo " purge_modules=\"$use_purge_modules\""
778798
fi
779799
echo "#"
780800
if (( ${#use_module_items[@]} == 0 )) ; then
781801
echo "# They need to be named, too. For example:"
782802
echo "#"
783-
echo "# load_modules[0]=\"CHEMISTRY\""
784-
echo "# load_modules[1]=\"xtb\""
803+
echo "# load_modules[0]=\"xtb\""
804+
echo "# load_modules[1]=\"CREST\""
785805
else
786806
echo "# Specified modules to be loaded:"
787807
echo "#"

configure/test_modules.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
###
4+
#
5+
# This configuration script is part of
6+
# runxtb.bash --
7+
# a repository to set the environment for the xtb program
8+
# Copyright (C) 2019 - 2024 Martin C Schwarzer
9+
#
10+
# This program is free software: you can redistribute it and/or modify
11+
# it under the terms of the GNU General Public License as published by
12+
# the Free Software Foundation, either version 3 of the License, or
13+
# (at your option) any later version.
14+
#
15+
# This program is distributed in the hope that it will be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU General Public License
21+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
#
23+
###
24+
25+
# This script should be used to test the capabilities of modules
26+
27+
#
28+
# Messaging functions
29+
#
30+
31+
message ()
32+
{
33+
local line
34+
while read -r line || [[ -n "$line" ]] ; do
35+
echo "INFO : $line"
36+
done <<< "$*"
37+
}
38+
39+
fatal ()
40+
{
41+
echo "ERROR : $*" >&2
42+
exit 1
43+
}
44+
45+
#
46+
# Main
47+
#
48+
49+
message "This helper script will test whether modules can be used."
50+
cmd=$(command -v module &> /dev/null) || fatal "Command moule not available."
51+
message "Modules are $cmd"
52+
53+
version=$(module --version 2>&1)
54+
message "Available Version: $version"
55+
56+
message "Checking 'module purge'"
57+
module purge || fatal "Check failed."
58+
message "Ok."
59+
60+
message "Checking whether exit codes work by loading a module 'designed2fail'."
61+
message "If this is actually a module on your system, then I'm sorry."
62+
module load designed2fail &> /dev/null && fatal "Exit status was 0; modules will not work."
63+
message "Ok."
64+
65+
message "Using modules with this script should work as asserted."
66+

0 commit comments

Comments
 (0)