regression.sh 3.66 KB
Newer Older
1 2 3 4 5
#!/bin/bash

#TODO color_echo

clean(){
6
	rm -f $1 *.o *.cpp *.hpp *.png *.dat *.prm *.mak Makefile *.vcproj  *.r *.plot *.pop 2> /dev/null;
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
}


test_case(){
  error_code=0;
  directory_name=$1
  easea_cflag=$2
  program_name=""
  number_gen=5 
  cd $directory_name;

  if [ -z "$3" ]; then
    program_name=$directory_name;
  else
    program_name=$3
  fi

  if [ ! -z "$4" ]; then
    number_gen=$4;
  fi

  echo"" 
29 30 31
  echo"" 
  echo "$(tput setaf 2)* $program_name *$(tput sgr 0)";
  echo "$(tput setaf 2)* --------------- *$(tput sgr 0)";
32 33
  clean $program_name;
  
34
  echo "$(tput setaf 6)Testing easea compilation of $easea_cflag $directory_name $(tput sgr 0)"
35 36 37
  easea $easea_cflag $program_name.ez > /dev/null;
  error_code=$?;
  if [[ $error_code != 0 ]] ; then
38
    echo "$(tput setaf 1)Error, easea compilation case $easea_cflag $directory_name $(tput sgr 0)"
39 40 41 42 43
    clean $program_name;
    #exit 1;
  else 
    echo "$(tput setaf 2)Pass !!! $(tput sgr 0)"

44
    echo "$(tput setaf 6)Testing compilation of $ $easea_cflag $directory_name generated source code$(tput sgr 0)"
45 46 47
    make > /dev/null;
    error_code=$?;
    if [[ $error_code != 0 ]] ; then
48
      echo $(tput setaf 1)"Error, compilation case $easea_cflag $directory_name $(tput sgr 0)"
49 50 51 52 53
      clean $program_name;
      #exit 2;
    else 
      echo "$(tput setaf 2)Pass !!! $(tput sgr 0)"

54
      echo "$(tput setaf 6)Testing runtime execution of $easea_cflag $directory_name $(tput sgr 0)"
55 56 57 58 59 60 61 62 63 64 65
      ./$program_name --plotStats 0 --remoteIslandModel 0 --nbGen $number_gen > /dev/null;
      error_code=$?;
      if [[ $error_code != 0 ]] ; then
        echo "$(tput setaf 1)Error, runtime $(tput sgr 0)"
        clean $program_name;
        #exit 3;
      else 
        echo "$(tput setaf 2)Pass !!! $(tput sgr 0)"
      fi 
    fi
  fi
66
  clean $program_name;
67 68 69 70 71
  cd ..;
}

main(){

72 73 74
  echo "$(tput setaf 2)****************$(tput sgr 0)";
  echo "$(tput setaf 2)*STD tests case *$(tput sgr 0)";
  echo "$(tput setaf 2)****************$(tput sgr 0)";
75 76 77
  test_case ant "" "" "";
  test_case bbob2013 "" "" "";
  test_case listsort "" "" "";
78
  test_case michalewicz "" "" "1";
79 80
  test_case rastrigin "" "" "";
  test_case sphere "" "" "";
81
  test_case weierstrass "" "" "1";
82
  test_case cmaes_tests "" "cigtab" "";
83 84 85 86 87 88 89
  test_case memetic_std "" "memetic_weierstrass" "1";
  test_case memetic_std_custom "" "memetic_weierstrass" "1";
  
  echo "";
  echo "$(tput setaf 2)******************$(tput sgr 0)";
  echo "$(tput setaf 2)*CUDA tests case *$(tput sgr 0)"
  echo "$(tput setaf 2)******************$(tput sgr 0)";
90
  test_case cmaes_cuda_test "cuda" "cigtabGPU" "";
91 92
  test_case memetic_cuda "cuda_mem" "memetic_weierstrass" "1";
  test_case memetic_cuda_custom "cuda_mem" "memetic_weierstrass" "1";
93
  test_case weierstrass "cuda" "" "";
94 95
  test_case michalewicz "cuda" "" "";
  test_case rastrigin "cuda" "" "";
96

97 98 99 100 101 102 103
  echo "";
  echo "$(tput setaf 2)****************$(tput sgr 0)";
  echo "$(tput setaf 2)*GP tests case *$(tput sgr 0)";
  echo "$(tput setaf 2)****************$(tput sgr 0)";
  test_case regression "gp" "" "";
  test_case regression-network "gp" "regression" "";
  test_case regression_okto_simulation "gp" "regression" "1";
104

105 106 107 108 109 110 111 112 113 114 115 116 117
  echo "";
  echo "$(tput setaf 2)*********************$(tput sgr 0)";
  echo "$(tput setaf 2)*CUDA GP tests case *$(tput sgr 0)";
  echo "$(tput setaf 2)*********************$(tput sgr 0)";
  test_case regression "cuda_gp" "" "";
  test_case regression-network "cuda_gp" "regression" "";
  test_case regression_okto_simulation "cuda_gp" "regression" "";
  
  echo ""
  echo "$(tput setaf 2)*********************$(tput sgr 0)";
  echo "$(tput setaf 2)*CMAES tests case    *$(tput sgr 0)"
  echo "$(tput setaf 2)*********************$(tput sgr 0)";
}
118

119
main ;