Skip to content

Yaml Schema Draft

Shahzeb Siddiqui edited this page Mar 13, 2020 · 3 revisions

YAML Examples

example1.yml

Description: Hello World C example with module load GCC/6.4.0 using gnu compiler

# module load example with one version
version: 0.0.1
hello_ex1:
  type: singlesource
  description: "C hello world example1"
  compiler: gnu
  source: hello.c
  scheduler: local
  moduleload:
    key:
      name: GCC
      version: ["6.4.0"]
  cflags: "-O1"

The above example will generate two test-script in the format of "filename"."subtest".sh without the yml extension. So we will have the following tests: example1.hello_ex1.sh with the following content:

#!/bin/bash
module purge
module load GCC/6.4.0
srcfile="src/hello.c"
exec="0x12b2f" # random hex value generated, could vary in length
cc=gcc
cflags="-O1"

$cc $cflags -o $exec $srcfile
./$exec
rm ./$exec

example2.yml

Description: Hello World C++ example using gnu compiler but using module restore

version: 0.0.1
# module restore example for C
hello_ex1:
  type: singlesource
  description: "C++ hello world example"
  compiler: gnu
  source: hello.cpp
  scheduler: local
  # module collection to restore
  moduleload:
    collection: "GCC"
  cxxflags: "-O2"

The test content for example2.hello_ex1.sh is the following

#!/bin/bash
module purge
module restore GCC
srcfile="src/hello.cpp"
exec="0x34519a" # random hex value generated, could vary in length
cxx=g++
cxxflags="-O2"

$cxx $cxxflags -o $exec $srcfile
./$exec
rm ./$exec

openmp_ex1.yml

Description: OpenMP example using gnu, in this example we introduce environment variables

version: 0.0.1
  hello_gnu:
    type: singlesource
    source: hello.c
    env:
      OMP_NUM_THREADS: 2
    compilers: gnu
    cflags: "-O2 -fopenmp"

  intel_example:
    type: singlesource
    source: hello.c
    moduleload:
      raw: |
      module purge
      module load GCC
      module load intel
      module load impi

    
    env:
      OMP_NUM_THREADS: 2
    compilers: intel
    cflags: "-O2 -fopenmp"

Content for testscript: openmp_ex1.hello_gnu.sh

#!/bin/bash
srcfile="src/hello.c"
exec="0x34519a" # random hex value generated, could vary in length
export OMP_NUM_THREADS=2
cc=gcc
cflags="-O2 -fopenmp"

$cc $cflags -o $exec $srcfile
./$exec
rm ./$exec

Test example openmp_ex1.intel_example.sh. The example below is for intel using raw modules injected right into script.

#!/bin/bash
module purge
module load GCC
module load intel
module load impi
srcfile="src/hello.c"
exec="0x34519a" # random hex value generated, could vary in length
export OMP_NUM_THREADS=2
cc=icc
cflags="-O2 -fopenmp"

$cc $cflags -o $exec $srcfile
./$exec
rm ./$exec