Home
%3CLINGO-SUB%20id%3D%22lingo-sub-773618%22%20slang%3D%22en-US%22%3ERunning%20HPC-X%20on%20SR-IOV%20enabled%20HPC%20instances%20in%20Azure%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-773618%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId-1795176799%22%20id%3D%22toc-hId-1795176799%22%3ECluster%20Setup%3A%3C%2FH2%3E%0A%3CP%3ETo%20setup%20the%20cluster%20please%20follow%20the%20steps%20in%20the%26nbsp%3B%3CA%20title%3D%22Simple%20HPC%20cluster%22%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazurehpc%2Fblob%2Fmaster%2Fexamples%2Fsimple_hpc_pbs%2Freadme.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Esimple_hpc_pbs%3C%2FA%3E%26nbsp%3Bexample.%20This%20will%20deploy%20a%20cluster%20that%20can%20be%20used%20for%20this%20example%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20your%20cluster%20is%20up%20and%20running%20and%20you%20are%20logged%20in%20to%20the%20headnode%20you%20are%20ready%20to%20proceed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20we%20will%20start%20with%20building%20Hello%20world%20using%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fwww.mellanox.com%2Fpage%2Fproducts_dyn%3Fproduct_family%3D189%26amp%3Bmtag%3Dhpc-x%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHPC-X%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%23%20Setup%20the%20directory%20path%3CBR%20%2F%3Emkdir%20-p%20~%2Fmpi%2Fhello%3CBR%20%2F%3Ecd%20~%2Fmpi%2Fhello%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Download%20hello.c%0Awget%20https%3A%2F%2Fwww.open-mpi.org%2Fpapers%2Fworkshop-2006%2Fhello.c%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Setup%20HPC-X%20environment%3CBR%20%2F%3Ehpcx_dir%3D%24(ls%20-atr%20%2Fopt%20%7C%20grep%20hpcx-*%20%7C%20tail%20-n1)%3CBR%20%2F%3Emodule%20use%20%2Fopt%2F%24hpcx_dir%2Fmodulefiles%3CBR%20%2F%3Emodule%20load%20hpcx%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Build%20hello%20executable%3CBR%20%2F%3Empicc%20-o%20hello%20hello.c%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Find%20the%20PKEY%3CBR%20%2F%3EPKEY%3D%60cat%20%2Fsys%2Fclass%2Finfiniband%2Fmlx5_0%2Fports%2F1%2Fpkeys%2F*%20%7C%20grep%20-v%200000%20%7C%20grep%20-v%200x7fff%60%3CBR%20%2F%3EPKEY%3D%60echo%20%24%7BPKEY%2F0x8%2F0x0%7D%60%3CBR%20%2F%3Eecho%20%22PKEY%3A%20%24PKEY%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Find%20the%20hosts%20that%20were%20provisioned%3CBR%20%2F%3Epbsnodes%20-avS%20%7C%20grep%20%5Ecomp%20%7C%20awk%20'%7Bprint%20%241%7D'%20%26gt%3B%20hostfile.txt%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Run%20your%20hello%20executable%20using%20mpirun%3CBR%20%2F%3Empirun%20-np%202%20-hostfile%20hostfile.txt%20-x%20UCX_IB_PKEY%3D%24PKEY%20-x%20UCX_NET_DEVICES%3Dmlx5_0%3A1%20hello%3CBR%20%2F%3EHello%2C%20World.%20I%20am%201%20of%202%3CBR%20%2F%3EHello%2C%20World.%20I%20am%200%20of%202%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20concludes%20this%20example.%20Please%20let%20me%20know%20if%20you%20have%20any%20questions%20or%20would%20like%20to%20see%20additional%20examples%20on%20the%20latest%20Azure%20specialized%20compute%20(H%2C%20HB%2C%20and%20HC)%20instances.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-773618%22%20slang%3D%22en-US%22%3E%3CP%3EWith%20the%20release%20of%20the%20HB%20and%20HC%20instances%20with%20SR-IOV%20support%20in%20Azure%2C%20HPC%20customers%20now%20are%20able%20to%20run%20the%20many%20MPI%20variants%20over%20Infiniband.%20To%20help%20support%20this%20effort%20we%20have%20released%20a%20marketplace%20image%20(Openlogic%20CentOS%207.6%20HPC)%20in%20Azure%20that%20has%20many%20MPI%20variants%20pre-installed.%20This%20article%20will%20cover%20how%20to%20run%20HPC-X%20and%20Intel%20MPI%20on%20this%20new%20marketplace%20image%20on%20an%20HB%2FHC%20system%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-773618%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHPC%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Cluster Setup:

To setup the cluster please follow the steps in the simple_hpc_pbs example. This will deploy a cluster that can be used for this example

 

Once your cluster is up and running and you are logged in to the headnode you are ready to proceed.

 

First, we will start with building Hello world using HPC-X

 

# Setup the directory path
mkdir -p ~/mpi/hello
cd ~/mpi/hello

# Download hello.c wget https://www.open-mpi.org/papers/workshop-2006/hello.c

# Setup HPC-X environment
hpcx_dir=$(ls -atr /opt | grep hpcx-* | tail -n1)
module use /opt/$hpcx_dir/modulefiles
module load hpcx

# Build hello executable
mpicc -o hello hello.c

# Find the PKEY
PKEY=`cat /sys/class/infiniband/mlx5_0/ports/1/pkeys/* | grep -v 0000 | grep -v 0x7fff`
PKEY=`echo ${PKEY/0x8/0x0}`
echo "PKEY: $PKEY"

# Find the hosts that were provisioned
pbsnodes -avS | grep ^comp | awk '{print $1}' > hostfile.txt

# Run your hello executable using mpirun
mpirun -np 2 -hostfile hostfile.txt -x UCX_IB_PKEY=$PKEY -x UCX_NET_DEVICES=mlx5_0:1 hello
Hello, World. I am 1 of 2
Hello, World. I am 0 of 2

 

This concludes this example. Please let me know if you have any questions or would like to see additional examples on the latest Azure specialized compute (H, HB, and HC) instances.