...
Code Block | ||
---|---|---|
| ||
#!/bin/bash # ------------------------------------------------------------ export MODULEPATH=/etc/modulefiles:/usr/share/modulefiles || : source /usr/share/lmod/lmod/init/profile if [ -f "/opt/software/pc2/lmod/modules/DefaultModules.lua" ];then export MODULEPATH="$MODULEPATH:/opt/software/pc2/lmod/modules" export LMOD_SYSTEM_DEFAULT_MODULES="DefaultModules" else if [ -f "/usr/share/modulefiles/StdEnv.lua" ];then export LMOD_SYSTEM_DEFAULT_MODULES="StdEnv" fi fi module --initial_load restore # ------------------------------------------------------------ mlmodule load lang module mlload JuliaHPC # or module load Julia exec julia "${@}" |
and make the “Executable Path” setting of the Julia extension (julia.executablePath
) point to this file. (Note: The first block makes the module
command available.)
Using a direnv
environment with the integrated Julia REPL
Modify the script above to the following:
Code Block | ||
---|---|---|
| ||
#!/bin/bash # ------------------------------------------------------------ export MODULEPATH=/etc/modulefiles:/usr/share/modulefiles || : source /usr/share/lmod/lmod/init/profile if [ -f "/opt/software/pc2/lmod/modules/DefaultModules.lua" ];then export MODULEPATH="$MODULEPATH:/opt/software/pc2/lmod/modules" export LMOD_SYSTEM_DEFAULT_MODULES="DefaultModules" else if [ -f "/usr/share/modulefiles/StdEnv.lua" ];then export LMOD_SYSTEM_DEFAULT_MODULES="StdEnv" fi fi module --initial_load restore # ------------------------------------------------------------ DIRENV=$HOME/.local/bin/direnv # path to you direnv binary export DIRENV_BASH=/bin/bash ml lang ml JuliaHPC if [ -z "${JULIA_LANGUAGESERVER}" ]; then # REPL process; use direnv exec to load .envrc file exec "${DIRENV}" exec "${PWD}" julia "${@}" else # Language Server process; exec the fallback julia exec julia "${@}" fi |
This will load the direnv
environment when starting the integrated Julia REPL (and only the JuliaHPC
module when starting the Julia Language Server).