mirror of
https://github.com/LCPQ/quantum_package
synced 2024-10-19 22:41:48 +02:00
Added qpsh, the QP shell
This commit is contained in:
parent
0c02733cde
commit
4258a7a6f2
6
configure
vendored
6
configure
vendored
@ -378,10 +378,14 @@ echo " ||----w | "
|
|||||||
echo " || || "
|
echo " || || "
|
||||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Now:"
|
echo "Now, if you want to use the current shell,"
|
||||||
echo ""
|
echo ""
|
||||||
echo " source $QP_ROOT/quantum_package.rc"
|
echo " source $QP_ROOT/quantum_package.rc"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Or if you want to use a Bash shell adapted for QP:"
|
||||||
|
echo ""
|
||||||
|
echo " $QP_ROOT/qpsh"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
19
etc/ezfio.rc
19
etc/ezfio.rc
@ -1,15 +1,10 @@
|
|||||||
if [[ -z $QP_EZFIO ]]
|
export QP_EZFIO=${QP_ROOT}/external/ezfio
|
||||||
then
|
|
||||||
|
|
||||||
export QP_EZFIO=${QP_ROOT}/external/ezfio
|
|
||||||
|
|
||||||
if [[ $SHELL == "/bin/bash" ]] ; then
|
|
||||||
if [[ -f ${QP_EZFIO}/Bash/ezfio.sh ]]; then
|
|
||||||
source ${QP_EZFIO}/Bash/ezfio.sh
|
|
||||||
else
|
|
||||||
echo "EZFIO is not installed."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [[ -f ${QP_EZFIO}/Bash/ezfio.sh ]]; then
|
||||||
|
if [[ "$(ps -p $$ -ocomm=)" == "zsh" ]] ; then
|
||||||
|
autoload bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
fi
|
||||||
|
source ${QP_EZFIO}/Bash/ezfio.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
if [[ -z $QP_LIB ]]
|
QP_LIB=""
|
||||||
then
|
|
||||||
:
|
|
||||||
|
|
||||||
# Include here the optional external libraries to link with your binaries,
|
# Include here the optional external libraries to link with your binaries,
|
||||||
# for example
|
# for example :
|
||||||
# export QP_LIB="$QP_LIB -lint"
|
# export QP_LIB="$QP_LIB -lint"
|
||||||
|
|
||||||
fi
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
if [[ -z $QP_NIC ]]
|
|
||||||
then
|
|
||||||
:
|
|
||||||
|
|
||||||
# Choose the correct network interface if the default one is incorrect
|
# Choose the correct network interface if the default one is incorrect
|
||||||
# export QP_NIC=ib0
|
# export QP_NIC=ib0
|
||||||
# export QP_NIC=eth0
|
# export QP_NIC=eth0
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1 @@
|
|||||||
if [[ -z $NINJA ]]
|
export NINJA=${QP_ROOT}/bin/ninja
|
||||||
then
|
|
||||||
|
|
||||||
export NINJA=${QP_ROOT}/bin/ninja
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
157
etc/qp.rc
Normal file
157
etc/qp.rc
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
if [[ "$(ps -p $$ -ocomm=)" == "zsh" ]] ; then
|
||||||
|
autoload bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ${QP_ROOT}/etc/ezfio.rc
|
||||||
|
|
||||||
|
function _qp_usage()
|
||||||
|
{
|
||||||
|
echo "
|
||||||
|
Usage:
|
||||||
|
qp set_file EZFIO_DIRECTORY
|
||||||
|
qp unset_file
|
||||||
|
|
||||||
|
qp has DIRECTORY ITEM
|
||||||
|
qp get DIRECTORY ITEM
|
||||||
|
qp set DIRECTORY ITEM VALUE : Scalar values
|
||||||
|
qp set DIRECTORY ITEM : Array values read from stdin
|
||||||
|
|
||||||
|
qp run PROGRAM
|
||||||
|
qp srun PROGRAM
|
||||||
|
qp mpirun PROGRAM
|
||||||
|
|
||||||
|
qp set_frozen_core
|
||||||
|
qp create_ezfio_from_xyz -help
|
||||||
|
qp set_mo_class -help
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
function qp()
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
"has"|"set"|"get"|"set_file"|"unset_file")
|
||||||
|
ezfio $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
"set_frozen_core")
|
||||||
|
shift
|
||||||
|
qp_set_frozen_core ${EZFIO_FILE}
|
||||||
|
;;
|
||||||
|
|
||||||
|
"create_ezfio_from_xyz")
|
||||||
|
shift
|
||||||
|
[[ -n $EZFIO_FILE ]] && ezfio unset_file
|
||||||
|
NAME=$(qp_create_ezfio_from_xyz $@)
|
||||||
|
ezfio set_file $NAME
|
||||||
|
;;
|
||||||
|
|
||||||
|
"set_mo_class")
|
||||||
|
shift
|
||||||
|
qp_set_mo_class ${EZFIO_FILE} $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
"edit")
|
||||||
|
shift
|
||||||
|
qp_edit ${EZFIO_FILE}
|
||||||
|
;;
|
||||||
|
|
||||||
|
"run")
|
||||||
|
shift
|
||||||
|
qp_run $@ ${EZFIO_FILE}
|
||||||
|
;;
|
||||||
|
|
||||||
|
"srun")
|
||||||
|
shift
|
||||||
|
qp_srun $@ ${EZFIO_FILE}
|
||||||
|
;;
|
||||||
|
|
||||||
|
"mpirun")
|
||||||
|
shift
|
||||||
|
qp_mpirun $@ ${EZFIO_FILE}
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
_qp_usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Complete()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
prev2="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
|
|
||||||
|
if [[ -n ${EZFIO_FILE} && -d ${EZFIO_FILE} ]]
|
||||||
|
then
|
||||||
|
|
||||||
|
case "${prev2}" in
|
||||||
|
"set"|has|get)
|
||||||
|
if [[ ${prev} == "qp" ]] ; then
|
||||||
|
COMPREPLY=( $(compgen -W "set set_frozen_core set_mo_class" -- $cur ) )
|
||||||
|
elif [[ ! -d ${EZFIO_FILE}/${prev} ]] ; then
|
||||||
|
COMPREPLY=( $(compgen -W "" -- $cur ) )
|
||||||
|
else
|
||||||
|
COMPREPLY=( $(compgen -W "$(cd ${EZFIO_FILE}/${prev} ; ls | sed 's/\.gz//' )" -- $cur ) )
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $(compgen -W "$(\ls)" -- $cur ) )
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${prev}" in
|
||||||
|
run|srun|mpirun)
|
||||||
|
COMPREPLY=( $(compgen -W "$(cat ${QP_ROOT}/data/executables | cut -d ' ' -f 1)" -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
unset_file|edit|set_frozen_core)
|
||||||
|
COMPREPLY=()
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
set_mo_class)
|
||||||
|
COMPREPLY=( $(compgen -W "-h -core -inact -act -virt -del" -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
set|has|get)
|
||||||
|
COMPREPLY=( $(compgen -W "$(cd ${EZFIO_FILE} ; \ls -d */ | sed 's|/||g')" -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $(compgen -W 'has get set unset_file edit \
|
||||||
|
run srun mpirun set_frozen_core \
|
||||||
|
set_mo_class create_ezfio_from_xyz \
|
||||||
|
-h' -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
case "${prev}" in
|
||||||
|
set_file)
|
||||||
|
COMPREPLY=( $(compgen -W "$(\ls -d */ | sed 's|/||g')" -- ${cur} ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
create_ezfio_from_xyz)
|
||||||
|
COMPREPLY=( $(compgen -W "$(\ls)" -- ${cur} ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $(compgen -W 'set_file \
|
||||||
|
create_ezfio_from_xyz \
|
||||||
|
-h' -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _Complete qp
|
@ -660,7 +660,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
end;
|
end;
|
||||||
raise ex;
|
raise ex;
|
||||||
end
|
end
|
||||||
in ()
|
in print_endline ezfio_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
qpsh
Executable file
11
qpsh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export QP_ROOT=$(dirname $0)
|
||||||
|
|
||||||
|
exec bash --init-file <(cat << EOF
|
||||||
|
PS1="[\u@\h \W] |\\\${EZFIO_FILE}> "
|
||||||
|
source $QP_ROOT/quantum_package.rc
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
QP_ROOT="/NOT/FOUND"
|
QP_ROOT="/NOT/FOUND"
|
||||||
case "$(ps -p $$ -ocomm=)" in
|
case "$(ps -p $$ -ocomm=)" in
|
||||||
zsh)
|
"zsh")
|
||||||
QP_ROOT=$(dirname $0)
|
QP_ROOT=$(dirname $0)
|
||||||
;;
|
;;
|
||||||
bash)
|
*)
|
||||||
QP_ROOT=$(dirname ${BASH_SOURCE}[0])
|
QP_ROOT=$(dirname ${BASH_SOURCE}[0])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user