Home
%3CLINGO-SUB%20id%3D%22lingo-sub-1115263%22%20slang%3D%22en-US%22%3ERun%20Spack%20on%20Azure%20and%20integrate%20the%20build%20cache%20with%20Azure%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1115263%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20your%20team%20runs%20high-performance%20computing%20(HPC)%20workloads%20on%20Azure%2C%20you%20can%20use%20a%20package%20manager%20to%20save%20time.%20%3CA%20href%3D%22https%3A%2F%2Fspack.readthedocs.io%2Fen%2Flatest%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESpack%3C%2FA%3E%20is%20a%20popular%20open-source%20package%20management%20tool%20written%20in%20Python%20that%20builds%20software%20packages%20from%20source.%20Spack%20allows%20you%20to%20rapidly%20and%20consistently%20install%20many%20HPC%20packages%20using%20scripts%20called%20recipes.%20These%20recipes%20make%20it%20easy%20to%20deploy%20all%20the%20Azure%20resources%20needed%20for%20a%20particular%20piece%20of%20software%2C%20and%20more%20than%202%2C500%20recipes%20for%20HPC%20packages%20already%20exist.%20%3CBR%20%2F%3EIn%20this%20post%2C%20we%20explore%20using%20Spack%20to%20build%20and%20install%20packages%20on%20Azure%20Virtual%20Machines%20for%20HPC%20workloads%20(HBv2%2C%20HB%2C%20and%20HC).%20For%20testing%20purposes%2C%20this%20deployment%20takes%20advantage%20of%20the%20MPI%20libraries%20installed%20on%20the%20CentOS-HPC%207.7%20image%20available%20from%20Azure%20Marketplace.%20It%20also%20integrates%20the%20Spack%20build%20cache%20with%20Azure%20Blob%20storage%20to%20create%20a%20repository%20for%20the%20pre-build%20binaries.%20%3CBR%20%2F%3ETo%20show%20how%20this%20process%20works%2C%20we%20will%20use%20Spack%20to%20build%20OSU%20micro-benchmarks%20that%20measure%20the%20performance%20of%20the%20CentOS%20MPI%20libraries.%20The%20steps%20below%20explain%20how%20to%20upload%20the%20build%20cache%20to%20Blob%20storage%2C%20install%20OSU%20micro-benchmarks%20using%20the%20Blob%20storage%20build%20cache%2C%20and%20use%20Portable%20Batch%20System%20(PBS)%20scripts%20to%20run%20the%20resulting%20executables.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--714327217%22%20id%3D%22toc-hId--714327217%22%3E%3CBR%20%2F%3EInstall%20Spack%20on%20Azure%3C%2FH4%3E%0A%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazurehpc%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Eazurehpc%3C%2FA%3E%20GitHub%20repository%20contains%20scripts%20(see%20apps%2Fspack%20directory)%20to%20automatically%20install%20Spack%20on%20Azure%2C%20set%20up%20suitable%20configuration%20files%2C%20and%20integrate%20the%20CentOS-HPC%207.7%20MPI%20libraries.%20The%20repository%20also%20provides%20example%20PBS%20scripts%20that%20you%20can%20use%20to%20run%20OSU%20micro-benchmark%20with%20different%20CentOS-HPC%207.7%20libraries%20(Open%20MPI%2C%20MVAPICH2%2C%20HPCx%2C%20and%20Intel%20MPI).%20%3CBR%20%2F%3ETo%20clone%20the%20GitHub%20repository%3A%3C%2FP%3E%0A%3CPRE%3Egit%20clone%20git%40github.com%3AAzure%2Fazurehpc.git%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20the%20azurehpc%20scripts%20as%20is%20for%20testing%2C%20but%20you%E2%80%99ll%20probably%20want%20to%20customize%20your%20Spack%20installation.%20To%20do%20that%2C%20edit%20the%20configuration%20files%20(config.yaml%2C%20modules.yaml%2C%20compiler.yaml%2C%20and%20packages.yaml).%20The%20azurehpc%20Spack%20installation%20script%20(build_spack.sh)%20creates%20these%20files%20in%20~hpcuser%2F.spack%20with%20suitable%20defaults.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20example%20scripts%20do%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EInstall%20all%20software%20packages%20in%20%2Fapps%2Fspack%2F%24sku_type%20(config.yaml)%20(where%20sku_type%20is%20hbv2%2C%20hb%2C%20or%20hc%20to%20indicate%20the%20target%20processor%20architecture).%3C%2FLI%3E%0A%3CLI%3EGenerate%20the%20Tcl%20module%20files%20at%20%2Fapps%2Fmodulefiles%2Fspack%2Ftcl%2F%24sku_type%20and%20the%20Lmod%20module%20files%20in%20%2Fapps%2Fmodules%2Fspack%2Flmod%2F%24sku_type%20(config.yaml).%3C%2FLI%3E%0A%3CLI%3EUse%2016%20processes%20by%20default%20for%20a%20parallel%20build%20(for%20example%2C%20make%20-j)%20(config.yaml).%3C%2FLI%3E%0A%3CLI%3EUse%20the%20CentOS-HPC%207.7%20MPI%20libraries%20(they%20are%20not%20rebuilt).%20See%20the%20packages.yaml%20configuration%20file%20for%20details%20(packages.yaml%2C%20compiler.yaml).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20Make%20sure%20you%20build%20on%20one%20of%20the%20virtual%20machine%20types%20designed%20for%20HPC%20workloads%E2%80%94HBv2%2C%20HB%2C%20or%20HC.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-1773185616%22%20id%3D%22toc-hId-1773185616%22%3E%3CBR%20%2F%3EBuild%20and%20install%20OSU%20micro-benchmarks%3C%2FH4%3E%0A%3CP%3ETo%20build%20OSU%20micro-benchmarks%20with%20MVAPICH2%20(from%20the%20CentOS-HPC%207.7%20image)%2C%20run%20the%20following%20command%20in%20Azure%20CLI%3A%3C%2FP%3E%0A%3CPRE%3Espack%20install%20osu-micro-benchmarks%25gcc%409.2.0%5Emvapich2%402.3.2%20%3C%2FPRE%3E%0A%3CP%3EWhere%20%3CSTRONG%3E%25gcc%409.2.0%5Emvapich2%402.3.2%3C%2FSTRONG%3E%20is%20the%20spec%2C%20the%20syntax%20you%20use%20in%20Spack%20to%20specify%20versions%20and%20configuration%20options.%20Here%2C%20the%20spec%20tells%20Spack%20to%20use%20the%20gcc%409.2.0%20compiler%20and%20the%20mvapich2%402.3.2%20MPI%20library.%20%3CBR%20%2F%3ETo%20see%20the%20detailed%20installation%20options%20and%20software%20dependencies%20for%20a%20given%20package%2C%20use%3A%3C%2FP%3E%0A%3CPRE%3Espack%20info%20PACKAGE_NAME%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESimilarly%2C%20you%20can%20build%20OSU%20micro-benchmarks%20using%20Open%20MPI%3A%3C%2FP%3E%0A%3CPRE%3Espack%20install%20osu-micro-benchmarks%25gcc%409.2.0%5Eopenmpi%404.0.2%20%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3EOr%20HPCx%3A%3C%2FP%3E%0A%3CPRE%3Espack%20install%20osu-micro-benchmarks%25gcc%409.2.0%5Ehpcx%402.5.0%20%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3EOr%20Intel%20MPI%3A%3C%2FP%3E%0A%3CPRE%3E.%20%2Fopt%2Fintel%2Fimpi%2F2019.5.281%2Fintel64%2Fbin%2Fmpivars.sh%20%3CBR%20%2F%3Espack%20install%20--dirty%20osu-micro-benchmarks%25gcc%409.2.0%5Eintel-mpi%402019.5.281%20%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20%E2%80%93dirty%20installation%20option%20allows%20Spack%20to%20use%20the%20current%20environment%20to%20build%20the%20software%20and%20use%20the%20Intel%20MPI%20environment%20to%20set%20my%20mpivars.sh.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--34268847%22%20id%3D%22toc-hId--34268847%22%3E%3CBR%20%2F%3ESet-up%20the%20build%20cache%20on%20Blob%20storage%3C%2FH4%3E%0A%3CP%3ECreating%20the%20build%20cache%20Azure%20is%20a%20two-step%20procedure.%20The%20first%20step%20is%20to%20create%20the%20build%20cache%20locally.%20Then%20you%20can%20upload%20the%20local%20build%20cache%20to%20Blob%20storage.%20After%20your%20software%20is%20on%20Blob%20storage%20in%20a%20build%20cache%2C%20you%20can%20install%20it%20anytime%20from%20the%20build%20cache%20without%20the%20need%20to%20recompile%20the%20package.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%201.%20To%20create%20local%20build%20cache%2C%20go%20to%20the%20home%20directory%20of%20the%20virtual%20machine%20and%20run%3A%3C%2FP%3E%0A%3CPRE%3Ecd%20~hpcuser%20%3C%2FPRE%3E%0A%3CPRE%3Emkdir%20-p%20buildcache%2F%24%7Bsku_type%7D%20%3C%2FPRE%3E%0A%3CPRE%3Ecd%20buildcache%2F%24%7Bsku_type%7D%20%3C%2FPRE%3E%0A%3CPRE%3Espack%20buildcache%20create%20-k%20%24%7Bsku_type%7D_gpg%20SPEC%3C%2FPRE%3E%0A%3CP%3EWhere%20%3CSTRONG%3ESPEC%3C%2FSTRONG%3E%20corresponds%20to%20the%20installed%20software%20(%3CSTRONG%3Eosu-micro-benchmarks%25gcc%409.2.0%5Eopenmpi%404.0.2%3C%2FSTRONG%3E)%2C%20and%20the%20%3CSTRONG%3E-k%3C%2FSTRONG%3E%20option%20specifies%20the%20GPG%20key%20to%20use%20to%20sign%20the%20software.%20(A%20GPG%20key%20was%20generated%20as%20part%20of%20the%20azurehpc%20Spack%20installation.%20To%20see%20all%20available%20GPG%20keys%2C%20use%20%3CSTRONG%3Espack%20gpg%20list%3C%2FSTRONG%3E).%20%3CBR%20%2F%3EIf%20you%20need%20to%20retrieve%20software%20from%20the%20build%20cache%20later%2C%20remember%20to%20store%20your%20GPG%20keys%20using%20spack%20gpg%20expor%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%202.%20To%20upload%20local%20build%20cache%20to%20your%20Blob%20storage%20account%2C%20use%20AzCopy%20V10%20as%20follows%3A%3C%2FP%3E%0A%3CPRE%3Eazcopy%20sync%20%22%2Fshare%2Fhome%2Fhpcuser%2Fbuildcache%22%20%22%26lt%3BSTORAGE_ENDPOINT%26gt%3B%2Fbuildache%26lt%3BSAS_KEY%26gt%3B%20--recursive%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%203.%20Tell%20Spack%20to%20use%20the%20Blob%20storage%20account%20as%20a%20build%20cache%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Espack%20mirror%20add%20%24%7Bsku_type%7D_buildcache%20%E2%80%9C%26lt%3BSTORAGE_ENDPOINT%26gt%3B%2Fbuildcache%2F%24%7Bsku_type%7D%26lt%3BSAS_KEY%26gt%3B%E2%80%9D%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%204.%20Check%20that%20you%20can%20see%20all%20the%20software%20(identified%20by%20%3CSPEC%3E%20or%20%3CHASH%3E)%20available%20in%20the%20build%20cache%3A%3C%2FHASH%3E%3C%2FSPEC%3E%3C%2FP%3E%0A%3CPRE%3Espack%20buildcache%20list%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%205.%20To%20install%20software%20from%20the%20build%20cache%3A%3C%2FP%3E%0A%3CPRE%3Espack%20buildcache%20install%20%26lt%3BSPEC%26gt%3B%20or%20%26lt%3BHASH%26gt%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%206.%20If%20you%20want%20to%20add%20software%20to%20an%20already%20existing%20build%20cache%20on%20Blob%20storage%2C%20copy%20your%20build%20cache%20locally.%20Add%20the%20software%20to%20the%20local%20build%20cache%2C%20then%20copy%20the%20local%20build%20cache%20to%20Blob%20storage.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--1841723310%22%20id%3D%22toc-hId--1841723310%22%3ETest%20the%20installed%20software%3C%2FH4%3E%0A%3CP%3EWe%20will%20use%20PBS%20to%20test%20OSU%20micro-benchmarks%20built%20with%20Spack.%20The%20PBS%20run%20scripts%20are%20available%20in%20the%20azurehpc%20repository.%20The%20following%20test%20uses%20the%20MVAPICH2%20osu_bw%20%2Fosu_latency%20PBS%20run%20script%20(osu_bw_latency_mvapich2.pbs).%20Similar%20scripts%20are%20available%20for%20the%20other%20MPI%20libraries.%3C%2FP%3E%0A%3CPRE%3E%3CBR%20%2F%3E%23!%2Fbin%2Fbash%26nbsp%3B%3CBR%20%2F%3ESHARED_APPS%3D%2Fapps%20%3CBR%20%2F%3Eexport%20OMP_NUM_THREADS%3D1%20%3CBR%20%2F%3E%3CBR%20%2F%3Emodule%20load%20gcc-9.2.0%20%3CBR%20%2F%3Emodule%20load%20mpi%2Fmvapich2-2.3.2%20%3CBR%20%2F%3Espack%20load%20osu-micro-benchmarks%5Emvapich2%20%3CBR%20%2F%3Ecat%20%24PBS_NODEFILE%20%3CBR%20%2F%3E%3CBR%20%2F%3Empirun%20osu_bw%20%3CBR%20%2F%3Esleep%202%20%3CBR%20%2F%3Empirun%20osu_latency%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20Spack%E2%80%99s%20spec%20syntax%2C%20you%20can%20specify%20the%20software%20to%20load%20using%20just%20enough%20of%20the%20name%20to%20uniquely%20identify%20it%E2%80%94for%20example%2C%20spack%20load%20osu-micro-benchmarks%5Emvapich2.%20You%20can%20also%20load%20the%20software%20with%20regular%20module%20load%20syntax%20if%20you%20prefer.%20%3CBR%20%2F%3EAssuming%20you%20have%20two%20HBv2%20nodes%2C%20each%20running%20a%20single%20MPI%20process%2C%20you%20would%20submit%20the%20test%20script%20as%20follows%3A%3C%2FP%3E%0A%3CPRE%3Eqsub%20-l%20select%3D2%3Ancpus%3D120%3Ampiprocs%3D1%20osu_bw_latency_mvapich2.pbs%20%3C%2FPRE%3E%0A%3CH4%20id%3D%22toc-hId-645789523%22%20id%3D%22toc-hId-645789523%22%3E%3CBR%20%2F%3ESummary%3C%2FH4%3E%0A%3CP%3ESpack%20can%20really%20save%20you%20time%20when%20managing%20HPC%20clusters%20on%20Azure%2C%20because%20you%20don%E2%80%99t%20have%20to%20build%20code%20and%20libraries%20by%20hand.%20It%E2%80%99s%20also%20very%20flexible.%20You%20can%20easily%20customize%20it%20to%20suit%20your%20requirements%20and%20get%20started%20quickly%20using%20the%20recipes%20that%20already%20exist%20for%20more%20than%202%2C500%20HPC%20packages.%20It%E2%80%99s%20pretty%20easy%20to%20write%20your%20own%20recipes%2C%20too.%20For%20more%20information%2C%20see%20the%20%3CA%20href%3D%22https%3A%2F%2Fspack.readthedocs.io%2Fen%2Flatest%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESpack%3C%2FA%3E%20website.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1115263%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20your%20team%20runs%20high-performance%20computing%20(HPC)%20workloads%20on%20Azure%2C%20you%20can%20use%20a%20package%20manager%20to%20save%20time.%20Spack%20is%20a%20popular%20open-source%20package%20management%20tool%20written%20in%20Python%20that%20builds%20software%20packages%20from%20source.%20Spack%20allows%20you%20to%20rapidly%20and%20consistently%20install%20many%20HPC%20packages%20using%20scripts%20called%20recipes.%20These%20recipes%20make%20it%20easy%20to%20deploy%20all%20the%20Azure%20resources%20needed%20for%20a%20particular%20piece%20of%20software%2C%20and%20more%20than%202%2C500%20recipes%20for%20HPC%20packages%20already%20exist.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1115263%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHPC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESoftware%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

If your team runs high-performance computing (HPC) workloads on Azure, you can use a package manager to save time. Spack is a popular open-source package management tool written in Python that builds software packages from source. Spack allows you to rapidly and consistently install many HPC packages using scripts called recipes. These recipes make it easy to deploy all the Azure resources needed for a particular piece of software, and more than 2,500 recipes for HPC packages already exist.


In this post, we explore using Spack to build and install packages on Azure Virtual Machines for HPC workloads (HBv2, HB, and HC). For testing purposes, this deployment takes advantage of the MPI libraries installed on the CentOS-HPC 7.7 image available from Azure Marketplace. It also integrates the Spack build cache with Azure Blob storage to create a repository for the pre-build binaries.


To show how this process works, we will use Spack to build OSU micro-benchmarks that measure the performance of the CentOS MPI libraries. The steps below explain how to upload the build cache to Blob storage, install OSU micro-benchmarks using the Blob storage build cache, and use Portable Batch System (PBS) scripts to run the resulting executables.


Install Spack on Azure

The azurehpc GitHub repository contains scripts (see apps/spack directory) to automatically install Spack on Azure, set up suitable configuration files, and integrate the CentOS-HPC 7.7 MPI libraries. The repository also provides example PBS scripts that you can use to run OSU micro-benchmark with different CentOS-HPC 7.7 libraries (Open MPI, MVAPICH2, HPCx, and Intel MPI).


To clone the GitHub repository:

git clone git@github.com:Azure/azurehpc.git

 

You can use the azurehpc scripts as is for testing, but you’ll probably want to customize your Spack installation. To do that, edit the configuration files (config.yaml, modules.yaml, compiler.yaml, and packages.yaml). The azurehpc Spack installation script (build_spack.sh) creates these files in ~hpcuser/.spack with suitable defaults.


The example scripts do the following:

 

  • Install all software packages in /apps/spack/$sku_type (config.yaml) (where sku_type is hbv2, hb, or hc to indicate the target processor architecture).
  • Generate the Tcl module files at /apps/modulefiles/spack/tcl/$sku_type and the Lmod module files in /apps/modules/spack/lmod/$sku_type (config.yaml).
  • Use 16 processes by default for a parallel build (for example, make -j) (config.yaml).
  • Use the CentOS-HPC 7.7 MPI libraries (they are not rebuilt). See the packages.yaml configuration file for details (packages.yaml, compiler.yaml).


Note: Make sure you build on one of the virtual machine types designed for HPC workloads—HBv2, HB, or HC.


Build and install OSU micro-benchmarks

To build OSU micro-benchmarks with MVAPICH2 (from the CentOS-HPC 7.7 image), run the following command in Azure CLI:

 

spack install osu-micro-benchmarks%gcc@9.2.0^mvapich2@2.3.2 

Where %gcc@9.2.0^mvapich2@2.3.2 is the spec, the syntax you use in Spack to specify versions and configuration options. Here, the spec tells Spack to use the gcc@9.2.0 compiler and the mvapich2@2.3.2 MPI library.


To see the detailed installation options and software dependencies for a given package, use:

 

spack info PACKAGE_NAME

 

Similarly, you can build OSU micro-benchmarks using Open MPI:

 

spack install osu-micro-benchmarks%gcc@9.2.0^openmpi@4.0.2 


Or HPCx:

 

spack install osu-micro-benchmarks%gcc@9.2.0^hpcx@2.5.0 


Or Intel MPI:

 

. /opt/intel/impi/2019.5.281/intel64/bin/mpivars.sh 
spack install --dirty osu-micro-benchmarks%gcc@9.2.0^intel-mpi@2019.5.281


The dirty installation option allows Spack to use the current environment to build the software and use the Intel MPI environment to set my mpivars.sh.


Set-up the build cache on Blob storage

Creating the build cache Azure is a two-step procedure. The first step is to create the build cache locally. Then you can upload the local build cache to Blob storage. After your software is on Blob storage in a build cache, you can install it anytime from the build cache without the need to recompile the package.

 

1. To create local build cache, go to the home directory of the virtual machine and run:

 

cd ~hpcuser 
mkdir -p buildcache/${sku_type} 
cd buildcache/${sku_type} 
spack buildcache create -k ${sku_type}_gpg SPEC

    Where SPEC corresponds to the installed software (osu-micro-benchmarks%gcc@9.2.0^openmpi@4.0.2), and the -k option specifies the GPG key to use to sign the software. (A GPG key was generated as part of the azurehpc Spack installation. To see all available GPG keys, use spack gpg list).


    If you need to retrieve software from the build cache later, remember to store your GPG keys using spack gpg expor

 

2. To upload local build cache to your Blob storage account, use AzCopy V10 as follows:

 

azcopy sync "/share/home/hpcuser/buildcache" "<STORAGE_ENDPOINT>/buildache<SAS_KEY> --recursive

 

3. Tell Spack to use the Blob storage account as a build cache:

 

spack mirror add ${sku_type}_buildcache “<STORAGE_ENDPOINT>/buildcache/${sku_type}<SAS_KEY>”

4. Check that you can see all the software (identified by <SPEC> or <HASH>) available in the build cache:

 

spack buildcache list

5. To install software from the build cache:

 

spack buildcache install <SPEC> or <HASH>

 

6. If you want to add software to an already existing build cache on Blob storage, copy your build cache locally. Add the software to the local build cache, then copy the local build cache to Blob storage.

 

Test the installed software

We will use PBS to test OSU micro-benchmarks built with Spack. The PBS run scripts are available in the azurehpc repository. The following test uses the MVAPICH2 osu_bw /osu_latency PBS run script (osu_bw_latency_mvapich2.pbs). Similar scripts are available for the other MPI libraries.

 


#!/bin/bash 
SHARED_APPS=/apps
export OMP_NUM_THREADS=1

module load gcc-9.2.0
module load mpi/mvapich2-2.3.2
spack load osu-micro-benchmarks^mvapich2
cat $PBS_NODEFILE

mpirun osu_bw
sleep 2
mpirun osu_latency

 

With Spack’s spec syntax, you can specify the software to load using just enough of the name to uniquely identify it—for example, spack load osu-micro-benchmarks^mvapich2. You can also load the software with regular module load syntax if you prefer.


Assuming you have two HBv2 nodes, each running a single MPI process, you would submit the test script as follows:

 

qsub -l select=2:ncpus=120:mpiprocs=1 osu_bw_latency_mvapich2.pbs 


Summary

Spack can really save you time when managing HPC clusters on Azure, because you don’t have to build code and libraries by hand. It’s also very flexible. You can easily customize it to suit your requirements and get started quickly using the recipes that already exist for more than 2,500 HPC packages. It’s pretty easy to write your own recipes, too. For more information, see the Spack website.