Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:usage:spack [2020/05/04 12:40] – [Managing Modules] keilingpublic:usage:spack [2024/03/04 11:40] (current) – [Basic Spack commands] keiling
Line 1: Line 1:
-====== Spack ====== +====== Spack v0.22 ======
-===== Getting Started =====+
  
-[[https://spack.io/|Spack]] is a tool that makes it easy for you to configure and maintain your own modules for your projects. It is recommended to use Spack since its easy to use and has lots of capabilities. Here we give brief overview of the least necessary steps to get you goingbut we advise to follow the [[https://spack.readthedocs.io/en/latest/getting_started.html#getting-started|Getting Started]] and [[https://spack.readthedocs.io/en/latest/tutorial.html#tutorial-spack-101|Tutorial 101]] of Spack. All of the following commands can be found at the [[https://spack.readthedocs.io/en/latest/basic_usage.html#basic-usage|Basic Usage]] chapter of Spack.+<note warning>Before you begin, please check if you really need to build your own software packages, since a lot of software is already installed on the system. For example, do you require the GCC, Open MPI, HDF5, Python, CMake or R? They are readily available. Especially when considering building your own MPI, [[https://spack.readthedocs.io/en/latest/getting_started.html#mpi|think twice]].</note>
  
-To get started, [[doku:goethehlr#Login|Login]] to the Goethe-HLR and run the two following commands in the console: +<note tip>Your are here for the first time? Jump to overview. 
-<code>git clone https://github.com/spack/spack.git</code>+You need to remove Spack? Jump to the bottom, follow the steps and then jump back to install Spack.</note>
  
-This will create a folder named "spack" into your home directory and clone the contents of the git repository into that newly created folder "spack". 
  
-<note important>We recommand to install Spack into your home directory. \\ +===== Overview - main goals ===== 
-/scratch is only for temporary files. See here [[public:usage:goethe-hlr#storage|storage]]</note>+  - Install Spack 
 +  - Access Spack anytime (aka sourcing - see below) 
 +  - Change ''build_stage'' directory from ''/tmp'' to ''/scratch'' 
 +  - Tell Spack what software is available on the cluster 
 +  Connecting two worlds (environment modules with Spack) 
 +  - Basic Spack commands 
 +  - A warning 
 +  - Maintenance 
 +     - Which version do I use? 
 +     - Update Spack 
 +     - Remove Spack  
  
-To add the Spack commands to your shell use. 
  
-<code>. spack/share/spack/setup-env.sh</code> +===== Install Spack =====
-<fc #ff0000>THIS STEP HAS TO BE MADE AFTER EACH LOGIN</fc>+
  
-If you want this to be permanent so that you can use the spack command after each login without executing the script firstYou can add the execution of the script to your .bashrcIn order to do so use+[[https://spack.io/|Spack]] is a tool that makes it easy for you to configure and maintain your own software packages. Here we give a brief overview of the least necessary steps to get you going, but we advise to follow the [[https://spack.readthedocs.io/en/latest/getting_started.html#getting-started|Getting Started]] and [[https://spack.readthedocs.io/en/latest/tutorial.html#tutorial-spack-101|Tutorial 101]] of Spack. All of the following commands can be found at the [[https://spack.readthedocs.io/en/latest/basic_usage.html#basic-usage|Basic Usage]] chapter of Spack.
  
-<code bash|Insert the following lines with an editor at the end of your ~/.bashrc > +Run the following command on the command line (if you are reinstalling Spack, [[#remove Spack]] first): 
-... + 
-SPACK_ROOT="/home/<your-project-name>/<your-user-name>/spack" +<code|Download Spack> 
-export PATH=$SPACK_ROOT/bin:$PATH +git clone -c feature.manyFiles=true https://github.com/spack/spack.git
-$SPACK_ROOT/share/spack/setup-env.sh+
 </code> </code>
 +  
 +This will create a folder named ''spack'' in your home directory and clone the contents of the Git repository into that newly created ''spack'' folder.
  
-<note warning>By default spack stores the temporary files under ''/tmp''. This is shared with all users on the cluster and should not be used for your spack installation. In order to change the directory spack uses for its temporary files you have to set the new directory in the ''config.yaml''. This can be done by the following commands.</note>+===== Access Spack anytime =====
  
-First open your ''config.yaml'' located under ''~/spack/etc/spack/defaults/'' then change  +Now source the appropriate script for your shell. Most users on the cluster use the [[https://de.wikipedia.org/wiki/Bash_(Shell)|Bash]] shell. 
-<code>  build_stage: + 
-     - $tempdir +<code|Sourcing> 
-     - $spack/var/spack/stage+# Sourcing these files will put the ''spack'' command in your ''PATH'', 
 +# set up your ''MODULEPATH'' to use Spack-generated modules, and add other 
 +# useful shell integration for certain commands, environments and 
 +# modulesFor ''bash'' and ''zsh'', it also sets up tab completion. 
 + 
 +# For bash/zsh/sh 
 + 
 +~/spack/share/spack/setup-env.sh 
 + 
 +# For tcsh/csh 
 + 
 +source ~/spack/share/spack/setup-env.csh
 </code> </code>
 +
 +
 +===== Change build_stage directory from /tmp to /scratch =====
 +To get started, [[goethe#login]] to the system and go to your home directory. As the very first step, **create a tempdir** for Spack builds (you will need it later):
 +
 +<code|Create your temp directory on /scratch>
 +# This is really important.
 +
 +mkdir -p /scratch/<path to your scratch folder>/spack/tmp
 +</code>
 +  
 +<note important>We recommend installing Spack into your home directory. Use ''/scratch'' for temporary data. If you don't know, what ''/scratch'' is, please read [[public:usage:goethe#storage|here]] (or [[public:usage:fuchs#storage|here]] for FUCHS).</note>
 +<note warning>By default Spack stores the temporary files under ''/tmp''. This is shared with all users on the cluster and should not be used for your Spack installation. **Spack files in ''/tmp'' will be deleted on a regular base within 30 minutes after creation**. In order to change the directory Spack uses for its temporary files you have to set the new directory in the ''config.yaml''. This can be done by the following commands.</note>
 +
 +The following steps show you what needs to be changed: 
 +<code|Access config.yaml>
 +# For instance you can use the following command to alter config.yaml
 +
 +nano ~/spack/etc/spack/defaults/config.yaml
 +</code>
 +
 +<file|~/spack/etc/spack/defaults/config.yaml (original file)>
 +  ... (stuff above) ...
 +  
 +  build_stage:
 +    - $tempdir/$user/spack-stage
 +    - $user_cache_path/stage
 +    # - $spack/var/spack/stage
 +    
 +  ... (stuff below) ...   
 +</file>
  
 to to
-<code>  build_stage: + 
-     - $tempdir +<file|~/spack/etc/spack/defaults/config.yaml (new file)> 
-     $spack/var/spack/stage +  ... (stuff above) ... 
-      - /scratch/<your-project-name>/<your-user-name>/spack/tmp+   
 +  build_stage: 
 +    This path must exist. Please create it if it's not already done. 
 +    For instance go to the folder /scratch/<your-project-name>/<your-user-name>/spack/tmp 
 +    # and type ''pwd'' and copy it to 
 +    # another terminal where you altering the config.yaml to avoid spelling errors. 
 +    - /scratch/<your-project-name>/<your-user-name>/spack/tmp 
 +   
 +  ...(stuff below)... 
 +</file> 
 + 
 +===== Tell Spack what software is available on the cluster ===== 
 + 
 +By default, Spack does not care about software that is already available on the system. You can tell Spack to locate it (please note that not everything can be found using this method, you may need to instruct Spack explicitly on what to find, as illustrated in Example 2). 
 + 
 +**Example 1**: 
 + 
 +<code|Find externals and compilers> 
 +
 +#  This will create .spack/packages.yaml 
 + 
 +[<user>@login01 ~]$ spack external find && spack external find slurm 
 +==> The following specs have been detected on this system and added to /home/<user>/.spack/packages.yaml 
 +autoconf@2.69    bison@3.7.4     curl@7.76.1      flex@2.6.4  gmake@4.3      m4@1.4.19      pkgconf@1.7.3 
 +automake@1.16.2  cmake@3.20.2    diffutils@3.7    gawk@5.1.0  groff@1.22.4   openssh@8.7p1  tar@1.34 
 +binutils@2.35.2  coreutils@8.32  findutils@4.8.0  git@2.39.3  libtool@2.4.6  openssl@3.0.7  texinfo@6.7 
 +==> The following specs have been detected on this system and added to /home/<user>/.spack/packages.yaml 
 +slurm@23.02.6 
 + 
 +[<user>@login01 ~]$ spack compiler find 
 +==> Added 1 new compiler to /home/<user>/.spack/linux/compilers.yaml 
 +  gcc@11.3.1 
 +==> Compilers are defined in the following files: 
 +  /home/<user>/.spack/linux/compilers.yaml
 </code> </code>
  
-<note important>The above ''/scratch PATH'' has to exist!</note> +**Example 2**: 
 + 
 +<code|Add an already available Open MPI and build NetCDF against it> 
 +[<user>@login01 ~]$ module load mpi/openmpi/5.0.0 
 +[<user>@login01 ~]$ spack external find openmpi 
 +==> The following specs have been detected on this system and added to /home/<user>/.spack/packages.yaml 
 +-- no arch / gcc@11.3.1 ----------------------------------------- 
 +openmpi@5.0.0 
 +[<user>@login01 ~]$ spack install netcdf-c 
 +</code> 
 + 
 +Spack will use the external packages when building new software instead of building all dependencies from scratch. On the other hand, it is not always desirable to use an external package. Pre-installed software (e.g. Perl) might lack needed features and using it as a dependency will fail. Then it's better to let Spack build its own version. 
 +===== Connecting two worlds ===== 
 + 
 +<note tip>This section can be skipped if your are in a hurry, it just provides some convenience.</note> 
 + 
 +It is important to distinguish between the cluster modules (see [[public:usage:goethe#Environment modules]]), your Spack packages, your private software and your private modules. You can install, list and load Spack packages using the ''spack'' command. Another way to use Spack packages are modules. If you don't need them or prefer not to use them, **you can also skip this section**. The cluster modules can be displayed with the ''module avail'' command, which looks like this: 
 + 
 +<code|Available cluster modules> 
 +[<user>@login02 ~]$ module avail 
 +--------------------- /cluster/modulefiles --------------------- 
 +intel/oneapi/2023.2.0  nvidia/hpc_sdk/nvhpc-byo-compiler/23.9   
 +intel/oneapi/latest    nvidia/hpc_sdk/nvhpc-hpcx-cuda12/23.9    
 +mpi/openmpi/4.1.6      nvidia/hpc_sdk/nvhpc-hpcx/23.9           
 +mpi/openmpi/5.0.0      nvidia/hpc_sdk/nvhpc-nompi/23.9          
 +nvidia/cuda/12.3.0     nvidia/hpc_sdk/nvhpc/23.9                
 + 
 +---------------- /usr/share/Modules/modulefiles ---------------- 
 +dot  module-git  module-info  modules  null  use.own   
 + 
 +-------------------- /usr/share/modulefiles -------------------- 
 +mpi/openmpi-x86_64   
 + 
 +Key: 
 +modulepath   
 +</code> 
 + 
 +Your Spack packages can be displayed with ''spack find''. Now imagine you could combine ''module avail'' with your Spack packages. The following example illustrate how to
 + 
 +<code|Connecting two worlds> 
 +# In this example Python version 3.11.6 will be installed 
 + 
 +spack info python              # Shows all available versions 
 +spack install python@3.11.6    # Preferred version at the time of writing this 
 + 
 +...after a while... 
 + 
 +==> python: Successfully installed python-3.11.6-2zpso6kw573oyfw5cdqt5lq5sbsazv73 
 +  Stage: 2.49s.  Configure: 44.94s.  Build: 21.50s.  Install: 16.89s.  Post-install: 22.83s.  Total: 1m 49.07s 
 +[+] /home/<user>/spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/python-3.11.6-2zpso6kw573oyfw5cdqt5lq5sbsazv73 
 + 
 +# Here you can learn some interesting details. 
 +# Spack knows that we have AlmaLinux on a Skylake compute node with AVX-512 instruction set, 
 +# also Spack uses our default compiler gcc-11.3.1. 
 +# It follows the desired python-3.11.6 version with a unique identifier 
 + 
 +# Why is this pointed out here? Please see section "A warning"
 + 
 +# Show me what I already installed with Spack: 
 + 
 +[<user>@login02 ~]$ spack find 
 +-- linux-almalinux9-skylake_avx512 / gcc@11.3.1 ----------------- 
 +berkeley-db@18.1.40                 expat@2.5.0     libbsd@0.11.7  libxcrypt@4.4.35  perl@5.38.0    sqlite@3.43.2           zlib-ng@2.1.4 
 +bzip2@1.0.8                         gdbm@1.23       libffi@3.4.4   libxml2@2.10.3    pkgconf@1.7.3  tar@1.34 
 +ca-certificates-mozilla@2023-05-30  gettext@0.22.3  libiconv@1.17  ncurses@6.4       python@3.11.6  util-linux-uuid@2.38.1 
 +diffutils@3.7                       gmake@4.3       libmd@1.0.4    openssl@3.1.3     readline@8.2   xz@5.4.1 
 +==> 25 installed packages 
 + 
 +# Refresh my modules to integrate them into the 'module avail' command. 
 + 
 +[<user>@login02 ~]$ spack module tcl refresh 
 +==> You are about to regenerate tcl module files for: 
 + 
 +-- linux-almalinux9-skylake_avx512 / gcc@11.3.1 ----------------- 
 +gndqrbp berkeley-db@18.1.40                 d35sdln gdbm@1.23       uffpwpo libiconv@1.17     36lhb6f openssl@3.1.3  gsfue6h sqlite@3.43.2 
 +plgyf6q bzip2@1.0.8                         oghfkbk gettext@0.22.3  53e2urm libmd@1.0.4       vthh2zs perl@5.38.0    7f6hcs7 tar@1.34 
 +yuvg6t3 ca-certificates-mozilla@2023-05-30  krzlwmr gmake@4.3       hza4ixw libxcrypt@4.4.35  e4dbf5o pkgconf@1.7.3  l5vb4dw util-linux-uuid@2.38.1 
 +o4iuzop diffutils@3.7                       siw2hgu libbsd@0.11.7   xzkdhcp libxml2@2.10.3    2zpso6k python@3.11.6  o2okcsd xz@5.4.1 
 +q5lazqy expat@2.5.0                         ni4xv7l libffi@3.4.4    7cld3mz ncurses@6.4       46kn2s6 readline@8.2   nmtn65b zlib-ng@2.1.4 
 + 
 +==> Do you want to proceed? [y/n] y 
 + 
 +# Important, refresh your spack environment or logout and login again 
 + 
 +. spack/share/spack/setup-env.sh 
 + 
 +# Finally type 
 + 
 +module avail 
 + 
 +[<user>@login02 ~]$ module avail 
 +------------------------------------------ /home/<user>/spack/share/spack/modules/linux-almalinux9-skylake_avx512 ------------------------------------------ 
 +python/3.11.6-gcc-11.3.1-2zpso6k 
 + 
 +---------------------------------------------------------------------- /cluster/modulefiles ----------------------------------------------------------------------- 
 +intel/oneapi/2023.2.0  mpi/openmpi/4.1.6  nvidia/cuda/12.3.0                      nvidia/hpc_sdk/nvhpc-hpcx-cuda12/23.9  nvidia/hpc_sdk/nvhpc-nompi/23.9 
 +intel/oneapi/latest    mpi/openmpi/5.0.0  nvidia/hpc_sdk/nvhpc-byo-compiler/23.9  nvidia/hpc_sdk/nvhpc-hpcx/23.9         nvidia/hpc_sdk/nvhpc/23.9 
 + 
 +----------------------------------------------------------------- /usr/share/Modules/modulefiles ------------------------------------------------------------------ 
 +dot  module-git  module-info  modules  null  use.own 
 + 
 +--------------------------------------------------------------------- /usr/share/modulefiles ---------------------------------------------------------------------- 
 +mpi/openmpi-x86_64 
 + 
 +Key: 
 +modulepath 
 +</code> 
 + 
 +<note tip>Every time when you install a new Spack module it is necessary to redo these two steps.\\ 
 +''spack module tcl refresh'' \\ 
 +''. spack/share/spack/setup-env.sh'' 
 +</note> 
 + 
 +As mentioned, this is only an example that can be set up quickly. If you wish further adjustments of your own modules, for example different name schemes, please look here: [[https://spack.readthedocs.io/en/latest/module_file_support.html|Spack modules]]  
  
-Now you are ready to install your own software and use it in your projects! 
  
 +===== Basic Spack commands =====
  
-===== Installing Software ===== 
 With Spack it is easy to install the software needed for you project. But before you try install it, you should make sure Spack has the packages you need and with the correct version. With Spack it is easy to install the software needed for you project. But before you try install it, you should make sure Spack has the packages you need and with the correct version.
  
Line 55: Line 250:
 <code>spack list <my-package-name></code> <code>spack list <my-package-name></code>
  
-If you need to know if spack has a specific version of your package, use +If you need to know if Spack has a specific version of your package, use 
 <code>spack versions <package-name></code> <code>spack versions <package-name></code>
  
Line 69: Line 264:
 If you also need it with a specific compiler, append  If you also need it with a specific compiler, append 
 <code>spack install <package-name>@version %<compiler-name></code> <code>spack install <package-name>@version %<compiler-name></code>
- 
  
 For further details visit [[https://spack.readthedocs.io/en/latest/basic_usage.html#specs-dependencies|Specs and Dependencies]] For further details visit [[https://spack.readthedocs.io/en/latest/basic_usage.html#specs-dependencies|Specs and Dependencies]]
  
 +===== Using packages =====
 +
 +You can use your installed packages in different ways. In many cases it is enough to know where they are installed so you could run a binary. To get the installation location of a package you can use the following command.
 +<code>spack location --install-dir <your package></code>
 +
 +One way to use a package is to load it:
 +
 +<code>spack load <your package></code>
  
-===== Managing Software Packages =====+Although a simple load is very useful in some cases it comes with some drawbacks, if there are more then one version of the package you want to load the load will fail, unless you specify exactly which of the packages you want to use. 
 +===== Managing software packages =====
  
 When you install multiple software packages, Spack uses all the already installed packages to install the new one. When you install multiple software packages, Spack uses all the already installed packages to install the new one.
Line 84: Line 287:
  
  
-If you only want to see your directly installed packages (installed with "spack install <package-name>) use+If you only want to see your directly installed packages (installed with ''spack install <package-name>'') use
 <code>spack find --explicit</code> <code>spack find --explicit</code>
  
-===== Managing Modules ===== +List loaded packages:
-If you install many software packages, "module avail" will print out all the installed software packages. +
-To clean things up, you can install **lmod** with +
-<code>spack install lmod</code>+
  
-After that you have to create a "modules.yaml" file in the ".spack" folder, e.g. by  +  spack find --loaded 
-<code>nano ~/.spack/modules.yaml</code> +===== Uninstalling software =====
- +
-There you can specify what modules will be listed by the "module avail" command. +
- +
-Your "modules.yaml" file should look like this, if you only want to show directly installed modules and want to show only necessary data. +
-<code> modules: +
-  tcl: +
-    # No hashs at the end of the module name +
-    hash_length:+
-    # For example openmpi/3.1.2%intel@19.1.0.166  +
-    naming_scheme: '{name}/{version}%{compiler.name}@{compiler.version}' +
-    blacklist_implicits: true +
-</code> +
-++++old nameing scheme syntax| +
-Spack changed the nameing scheme syntax for the module.yaml file. +
-This example shows the **old** syntax. +
-<code> +
-modules: +
-  tcl: +
-    # No hashs at the end of the module name +
-    hash_length:+
-    # For example openmpi/3.1.2-intel-19.1.0.166  +
-    naming_scheme: '${PACKAGE}/${VERSION}-${COMPILERNAME}-${COMPILERVER}' +
-    blacklist_implicits: true +
-</code> +
-++++ +
-Further details how to create your own flavor of modules.yaml files can be found here: [[https://spack-tutorial.readthedocs.io/en/latest/tutorial_modules.html|Module files]] +
- +
-The last step is to apply your "modules.yaml" setting by using +
-<code>spack module tcl refresh --delete-tree -y</code> +
-===== Uninstalling Software =====+
  
 Uninstalling software packages is as easy as installing them.  Uninstalling software packages is as easy as installing them. 
  
-First you should [[doku:goethehlr#Managing Software|find the package]] you want to uninstall.+First you should [[#Managing Software Packages|find the package]] you want to uninstall.
  
 Then uninstall the **package name with the version**  by using Then uninstall the **package name with the version**  by using
Line 137: Line 307:
 <code>spack find --deps gcc <package-name></code> <code>spack find --deps gcc <package-name></code>
  
-===== Adding new Compilers =====+===== Adding new compilers =====
  
-Spack has the ability to build packages with multiple compilers and compiler versions. To see which compilers spack has found on your system run+Spack has the ability to build packages with multiple compilers and compiler versions. To see which compilers Spack has found on your system run
 <code>spack compilers</code> <code>spack compilers</code>
  
-any of these compilers can be used to build spack packages. If you want to use a compiler which is not in this list you have to add it to your PATH first in order for spack to find it. You can add a new Compiler to your PATH by loading the module of the compiler. To see which modules are available use.+Any of these compilers can be used to build Spack packages. If you want to use a compiler which is not in this list you have to add it to your PATH first in order for Spack to find it. You can add a new Compiler to your PATH by loading the module of the compiler. To see which modules are available run
 <code>module avail</code> <code>module avail</code>
  
-then you can load the module of the compiler you want to add to spack+Then you can load the module of the compiler you want to add to Spack:
 <code>module load</code> <code>module load</code>
  
-When you have loaded the module of the compiler you want to add to spackuse+When you have loaded compiler modulerun
 <code>spack compiler find</code> <code>spack compiler find</code>
  
-to add the compiler to spack+to add the compiler to Spack.
  
 +++++Adding the Intel compiler (deprecated)|
 ===== Adding the Intel compiler ===== ===== Adding the Intel compiler =====
  
Line 175: Line 346:
 <code> <code>
 - compiler: - compiler:
 +    spec: intel@19.1.0.166
 +    paths:
 +      cc: /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/bin/intel64/icc
 +      cxx: /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/bin/intel64/icpc
 +      f77: /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/bin/intel64/ifort
 +      fc: /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/bin/intel64/ifort
 +    flags: {}
 +    operating_system: scientific7
 +    target: x86_64
 +    modules: []
     environment: {}     environment: {}
     extra_rpaths:     extra_rpaths:
     - /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64     - /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64
     - /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64_lin/     - /cluster/intel/2020.0/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64_lin/
-    flags: {} 
-    modules: [] 
-    operating_system: rhel7 
-    paths: 
-      cc: /cluster/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64/icc 
-      cxx: /cluster/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64/icpc 
-      f77: /cluster/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64/ifort 
-      fc: /cluster/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64/ifort 
-    spec: intel@19.0.1.144 
-    target: x86_64 
 </code> </code>
 +++++
  
-===== Using Packages =====+===== A warning =====
  
-You can use your installed packages in different waysIn many cases it is enough to know where they are installed so you could run a binaryTo get the installation location of a package you can use the following command. +Spack packages work on the machines on which they were built, but may not function on a different machine type((except a cross-compiler setting was used))If you need software packages for different nodes, e.g. GPU units, you need to compile them there. To accomplish this task we recommend to use SLURM's ''salloc'' command to work interactively on the desired node typePlease see here for further assistance: [[public:usage:goethe#the_salloc_command|The salloc Command]] (or [[public:usage:fuchs#the_salloc_command|here]] for FUCHS). 
-<code>spack location --install-dir [your package]</code>+===== Maintenance =====
  
-an other way to use a package is to load it +==== Which version do I use? ==== 
-<code>spack load [your package]</code>+<code|Spack version - Update required?> 
 +# Spack does not update itself. After a while you might see only old versions with 'spack info <package>'
 +# Use 'spack -V' to check your version. 
 +# Example: 
 +  
 +[user@login01 ~]$ spack -V 
 +0.22.0.dev0  (d1fa23e9c69c15d7e29354a82c7814d6836e0fbd) # 2024/03/04
  
-although a simple load is very useful in some cases it comes with some drawbacks, if there are more then one version of the package you want to load the load will fail, unless you specify exactly which of the packages you want to use. For more information see [[https://spack.readthedocs.io/en/latest/workflows.html#spack-generated-modules|Spack-Generated Modules]]. For better ways to assemble a consistent set of packages for building application programs see [[https://spack.readthedocs.io/en/latest/workflows.html#generated-load-scripts|Generated Load Scripts]]+</code>
  
-===== Remove spack ===== +==== Update Spack ==== 
-If something went wrong and you want to start from the scratch or just remove spack, please delete both following directories. +In some cases you do not find with ''spack info <package>'' what you are looking for. Then you might want to update Spack. 
-<code> +Here are some steps how to do so. 
-#Think twice before using this!+ 
 +<code|Update Spack> 
 +spack -V                            # Your own version of Spack 
 + 
 +1. cd ~/spack                       # Change into your Spack directory 
 +2. git pull                         # If an error appears see next box 
 +3. cd ..                            # Go one folder back 
 +4. . spack/share/spack/setup-env.sh # Update your environment 
 +</code> 
 + 
 +++++Some hints to errors due the update prozess| 
 + 
 +Following error appeared <code|git pull error> 
 +error: Your local changes to the following files would be overwritten by merge: 
 +        etc/spack/defaults/config.yaml 
 +Please, commit your changes or stash them before you can merge. 
 +Aborting 
 + 
 +# This error appears because you have changed the tmp-directory to  
 +# /scratch/<your-project-name>/<your-user-name>/spack/tmp, 
 +# as we advised (see section install), within the config.yaml. 
 +</code> during the ''git pull'' process. Here you can find a whole discussion about it [[https://stackoverflow.com/questions/15745045/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me|Link]] and how to solve it. 
 + 
 +<code|One possible way to go if you do not care about your old stuff> 
 +1. cd ~/spack              # Previous step like above 
 +2. git pull                # Error appears 
 +3. git stash save ""       # New step to deal with the error 
 +4. git pull                # Redo it again 
 +5. cd ~/spack/etc/spack/defaults/ 
 +6. Edit your 'config.yaml' # See at the top how to alter 
 +</code> 
 + 
 +Now you should be able so see the latest packages which Spack provides. 
 +++++ 
 +==== Remove Spack ==== 
 + 
 +If something went wrong and you want to start from the scratch or just remove Spack, please delete both following directories. 
 +<code|Remove Spack
 +# Think twice before doing this! You need to remove two directories.
 rm -rf /your-home-directory/spack rm -rf /your-home-directory/spack
 rm -rf /your-home-directory/.spack rm -rf /your-home-directory/.spack
 </code> </code>
- 
  
public/usage/spack.1588588828.txt.gz · Last modified: 2020/05/04 12:40 by keiling
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0