Thursday 16 December 2021

Bash : Select the column from list_file , decorate with double quotes at both side and put comma at the end of each line , concatenate


#!/bin/bash

## declare an array variable

declare -a arr=("Bcast" "Allreduce" "Reduce" "Allgather" "Allgatherv" "Allgatherv_int" "Scatter" "Scatterv" "Scatterv_int" "Gather" "Gatherv" "Gatherv_int" "Barrier" "Alltoall" "Alltoallv" "Alltoallv_int" "Scan" "Reduce_scatter" )

## now loop through the above array

j=0

echo "[collectives-smpi]" >> collectives.ini

for i in "${arr[@]}"

do

   echo "$i"

   ALGO=${i^^}

   ALL=$(awk "/^$j;/ "'{ print $0 }' OR=' ' all-coll.txt | cut -d ';' -f 3 |  awk '{ print "\""$0"\""}' | sed '$!s/$/,/' | awk '//' ORS=' ')

   echo "ALL_$ALGO=$ALL" >> collectives.ini

   ((j=j+1))

   echo "value of j is $j"

done

#----------------------------------------------------------------------

NOTE: You can also use 

   ALL_$i=$(awk '/^$i/' OR=' ' ${_TEST_DIR}/all-coll.txt | cut -d ';' -f 3 | sed -e 's/^\|$/"/g' | sed '$!s/$/,/' | tr -d '\n')

#----------------------------------------------------------------------

[Test get: fvt_bigMPI]


module = Copytree

copytree_directory = &getenv("fvt_bigMPI_src")


#----------------------------------------------------------------------

[Test build: fvt_bigMPI]


test_get = fvt_bigMPI


save_stdout_on_success = 1

merge_stdout_stderr = 1


module = Shell

shell_build_command = <<EOT

make compile

make generate

cp BigMPI/test/all-coll.txt $GLOBAL_SCRATCH/

declare -a arr=("Bcast" "Allreduce" "Reduce" "Allgather" "Allgatherv" "Allgatherv_int" "Scatter" "Scatterv" "Scatterv_int" "Gather" "Gatherv" "Gatherv_int" "Barrier" "Alltoall" "Alltoallv" "Alltoallv_int" "Scan" "Reduce_scatter" )

j=0

for i in "${arr[@]}"

do

   ALGO=${i^^}

   ALL=$(awk "/^$j;/ "'{ print $0 }' OR=' ' $GLOBAL_SCRATCH/all-coll.txt | cut -d ';' -f 3 | sed -e 's/^\|$/"/g' | sed '$!s/$/,/' | awk '//' ORS=' ')

   echo "ALL_$ALGO=$ALL" >> $GLOBAL_SCRATCH/collectives/collectives.ini

   ((j=j+1))

done

EOT

===============

 cat $MTT_CONF/collectives/collectives.ini

[collectives-smpi]

ALL_BCAST="EXT:Broadcast:EXT:EXT", "I0:2-nary:P2P:P2P", "I0:2-nomial:P2P:P2P", "I0:3-nary:P2P:P2P", "I0:3-nomial:P2P:P2P", "I0:4-nary:P2P:P2P", "I0:4-nomial:P2P:P2P", "I0:HybridBinomial:SHMEM:P2P", "I0:HybridMultiColor:Shmem:P2P", "I0:MultiColor:P2P:P2P", "I0:SequenceBased_Binomial:P2P:P2P"

ALL_ALLREDUCE="EXT:Allreduce:EXT:EXT", "I0:Binomial:P2P:P2P", "I0:HybridBinomial4:SHMEM:P2P", "I0:HybridBinomial:SHMEM:P2P", "I0:HybridMultiColor:SHMEM:P2P", "I0:MultiColor:P2P:P2P", "I0:MultinomialRadix4:P2P:P2P", "I0:MultinomialRadix8:P2P:P2P", "I0:SequenceBased_Binomial4:P2P:P2P", "I0:SequenceBased_Binomial:P2P:P2P", "I0:SequenceBased_Tree4:P2P:P2P", "I0:SequenceBased_Tree:P2P:P2P"

ALL_REDUCE="EXT:Reduce:EXT:EXT", "I0:HybridAsyncBinomial4:Shmem:P2P", "I0:HybridAsyncBinomial:Shmem:P2P", "I0:HybridMultiColor:SHMEM:P2P", "I0:MultiColor:P2P:P2P", "I0:SequenceBased_Binomial4:P2P:P2P", "I0:SequenceBased_Binomial:P2P:P2P", "I0:SequenceBased_Tree4:P2P:P2P", "I0:SequenceBased_Tree:P2P:P2P"

ALL_ALLGATHER="EXT:Allgather:EXT:EXT", "I0:Binomial:P2P:P2P", "I0:Flat:P2P:P2P", "I0:HybridFlat:Shmem:P2P", "I0:Ring:P2P:P2P"

ALL_ALLGATHERV="EXT:Allgatherv:EXT:EXT", "I0:HybridFlat:Shmem:P2P", "I0:Ring:P2P:P2P"

ALL_ALLGATHERV_INT="EXT:Allgatherv_int:EXT:EXT", "I0:HybridFlat:Shmem:P2P", "I0:Ring:P2P:P2P"

ALL_SCATTER="EXT:Scatter:EXT:EXT", "I0:Flat:P2P:P2P", "I0:ScatterMulticolorBcast:P2P:P2P"

ALL_SCATTERV="EXT:Scatterv:EXT:EXT", "I0:ScattervMulticolorBcast:P2P:P2P", "I0:SoftwareTree:P2P:P2P"

ALL_SCATTERV_INT="EXT:Scatterv_int:EXT:EXT", "I0:ScattervintMulticolorBcast:P2P:P2P", "I0:SoftwareTree:P2P:P2P"

ALL_GATHER="EXT:Gather:EXT:EXT", "I0:AsyncFlat:P2P:P2P", "I0:Binomial:P2P:P2P", "I0:Flat:P2P:P2P", "I0:HybridFlat:SHMEM:P2P"

ALL_GATHERV="EXT:Gatherv:EXT:EXT", "I0:FlatTree:P2P:P2P", "I0:HybridFlat:SHMEM:P2P"

ALL_GATHERV_INT="EXT:Gatherv_int:EXT:EXT", "I0:FlatTree:P2P:P2P", "I0:HybridFlat:SHMEM:P2P"

ALL_BARRIER="EXT:Barrier:EXT:EXT", "I0:Binomial4:P2P:P2P", "I0:Binomial:P2P:P2P", "I0:HybridBinomial:SHMEM:P2P", "I0:MultiLeaderBarrier:P2P:P2P"

ALL_ALLTOALL="EXT:Alltoall:EXT:EXT", "I0:Bruck:P2P:P2P", "I0:M2MComposite:P2P:P2P"

ALL_ALLTOALLV="EXT:Alltoallv:EXT:EXT", "I0:M2MComposite:P2P:P2P"

ALL_ALLTOALLV_INT="EXT:Alltoallv_int:EXT:EXT", "I0:M2MComposite:P2P:P2P"

ALL_SCAN="EXT:Scan:EXT:EXT", "I0:Binomial:P2P:P2P"

ALL_REDUCE_SCATTER="EXT:Reduce_scatter:EXT:EXT", "I0:Hybrid_Sequence_Tree_On_Allreduce:P2P:P2P", "I0:Sequence_Tree:P2P:P2P", "I0:Sequence_Tree_On_Allreduce:P2P:P2P" 

No comments:

Post a Comment