diff --git a/deploy/roles/spack/tasks/main.yml b/deploy/roles/spack/tasks/main.yml index a301e47..7608e73 100644 --- a/deploy/roles/spack/tasks/main.yml +++ b/deploy/roles/spack/tasks/main.yml @@ -1,119 +1,146 @@ --- - name: setting spack env block: - copy: src: .bashrc dest: /home/spack owner: spack group: spack - apt: name: "{{ item }}" with_items: - curl - g++ - gfortran - g++-6 - gfortran-6 - cmake - python - python3 - automake tags: - packages - shell: spack compiler find + register: spack_compiler become_flags: --login become: yes - + changed_when: "'Found no new compilers' not in spack_compiler.stdout" tags: spack - name: gathering facts block: - shell: gcc-6 -dumpversion register: gcc_version_gather changed_when: (gcc_version is undefined) or (gcc_version != gcc_version_gather.stdout) - - - shell: "spack find -p lmod arch=$(spack arch) | tail -n1 | awk '{ print $2; }'" - become: yes - become_flags: --login - register: lmod_path_gather - changed_when: (lmod_path is undefined) or (lmod_path != lmod_path_gather.stdout) - tags: lmod - shell: "spack arch" become: yes become_flags: --login register: spack_arch_gather changed_when: (spack_arch is undefined) or (spack_arch != spack_arch_gather.stdout) - - - set_fact: - gcc_version: "{{ gcc_version_gather.stdout }}" - cacheable: yes - set_fact: + gcc_version: "{{ gcc_version_gather.stdout }}" spack_arch: "{{ spack_arch_gather.stdout }}" cacheable: yes - - set_fact: - lmod_path: "{{ lmod_path_gather.stdout }}" - cacheable: yes - - setup: delegate_to: "{{ item }}" delegate_facts: True with_items: "{{ groups['frontal'] }}" tags: - facts - spack - - lmod -- name: setup lmod - block: - - file: - src: "{{ lmod_path_gather.stdout }}/lmod/lmod/init/sh" - state: link - dest: "/etc/profile.d/lmod.sh" - force: yes - - template: - src: lmod_conf.sh - dest: "/etc/profile.d/lmod_conf.sh" - tags: lmod - - name: installing spack block: - debug: var: gcc_versions - git: repo: 'https://github.com/spack/spack.git' dest: /softs/spack update: no - template: src: modules.yaml dest: /softs/spack/etc/spack vars: gcc_versions: "{{ groups['all'] | map('extract', hostvars, 'gcc_version') | list | select('defined') | sort | unique }}" + become: yes tags: spack when: "'frontal' in group_names" +- name: create groups per arch + group_by: + key: "{{ spack_arch }}" + tags: + spack + +- name: setup lmod + block: + - shell: "spack install lmod%gcc@{{ gcc_version }}" + become: yes + become_flags: --login + register: spack_install_lmod + when: "inventory_hostname == groups[spack_arch][0]" + changed_when: "'lmod is already installed' not in spack_install_lmod.stdout" + + - shell: "spack find -p lmod arch=$(spack arch) | tail -n1 | awk '{ print $2; }'" + become: yes + become_flags: --login + register: lmod_path_gather + changed_when: (lmod_path is undefined) or (lmod_path != lmod_path_gather.stdout) + + - set_fact: + lmod_path: "{{ lmod_path_gather.stdout }}" + cacheable: yes + + - file: + src: "{{ lmod_path_gather.stdout }}/lmod/lmod/init/sh" + state: link + dest: "/etc/profile.d/lmod.sh" + force: yes + + - template: + src: lmod_conf.sh + dest: "/etc/profile.d/lmod_conf.sh" + + tags: + - facts + - spack + - lmod + - name: setting up distcc block: - apt: name: "{{ item }}" with_items: - distcc tags: - packages - template: src: distcc_hosts dest: /etc/distcc/hosts notify: restart distcc - + - template: src: distcc dest: /etc/default/distcc notify: restart distcc when: "'frontal' not in group_names" tags: - spack - distcc + +- name: install softs with spack + shell: "spack install {{ item }}%gcc@{{ gcc_version }}" + become: yes + become_flags: --login + when: "inventory_hostname == groups[spack_arch][0]" + register: spack_install + changed_when: "'is already installed' not in spack_install_lmod.stdout_lines[-1]" + tags: + - spack + with_items: + - slurm diff --git a/deploy/roles/spack/templates/modules.yaml b/deploy/roles/spack/templates/modules.yaml index 3c25de0..ea042e7 100644 --- a/deploy/roles/spack/templates/modules.yaml +++ b/deploy/roles/spack/templates/modules.yaml @@ -1,104 +1,121 @@ # ------------------------------------------------------------------------- # This is the default configuration for Spack's module file generation. # # Settings here are versioned with Spack and are intended to provide # sensible defaults out of the box. Spack maintainers should edit this # file to keep it current. # # Users can override these settings by editing the following files. # # Per-spack-instance settings (overrides defaults): # $SPACK_ROOT/etc/spack/modules.yaml # # Per-user settings (overrides default and site settings): # ~/.spack/modules.yaml # ------------------------------------------------------------------------- modules: enable: - tcl - lmod prefix_inspections: bin: - PATH man: - MANPATH share/man: - MANPATH share/aclocal: - ACLOCAL_PATH lib: - LIBRARY_PATH - LD_LIBRARY_PATH lib64: - LIBRARY_PATH - LD_LIBRARY_PATH include: - CPATH lib/pkgconfig: - PKG_CONFIG_PATH lib64/pkgconfig: - PKG_CONFIG_PATH '': - CMAKE_PREFIX_PATH lmod: hash_length: 0 hierarchy: - mpi core_compilers: {% for version in gcc_versions %} - gcc@{{ version }} {% endfor %} all: suffixes: +mpi: mpi +openmp: openmp '^fftw+openmp': openmp +plumed: plumed '^cuda': cuda ^python@2.7.14: py2 ^python@3.6.5: py3 environment: set: '${PACKAGE}_ROOT': '${PREFIX}' blacklist: [ 'autoconf', 'automake', 'bison', 'bzip2', + 'expat', 'flex', 'gdbm', 'gettext', + 'glib', 'gmp', 'help2man', 'hwloc', 'inputproto', + 'json-c', 'kbproto', + 'libbsd', + 'libffi', + 'libgcrypt', + 'libgpg-error', + 'libiconv', 'libpciaccess', 'libpthread-stubs', 'libsigsegv', 'libtool', 'libx11', 'libxau', 'libxcb', 'libxdmcp', 'libxml2', + 'lmod', + 'lua', + 'lua-luafilesystem', + 'lua-luaposix', + 'lz4', 'm4', + 'munge', 'ncurses', 'openssl', + 'pcre', 'perl', 'pkgconf', 'readline', + 'slurm', 'sqlite', 'tar', 'texinfo', + 'unzip', 'util-macros', 'xcb-proto', 'xextproto', 'xproto', 'xtrans', 'xz', ]