<commit_before>#include "Client.h"
#include <string>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <iomanip>

/*******************************************************************************
 * main
 ******************************************************************************/
int main( int argc, char *argv[] ) {
  if (sizeof(size_t) != 8) {
    std::cout << "WARNING: Executable not 64-bit." << std::endl;
  }

  // parse command line parameters
  parseCommandLineParameters(argc, argv);

  // init runtime controls
  initControls();

  // init data
  unsigned int dataTypeIdx = 0;
  DataTypeEnum dataTypeEnum = dataTypeEnums[dataTypeIdx];
  bool invalids;
  switch(dataTypeEnum) {
#ifdef Tensile_DATA_TYPE_FLOAT
  case enum_float: {
    float *initialC_float;
    float *initialA_float;
    float *initialB_float;
    float alpha_float;
    float beta_float;
    float *referenceC_float;
    float *deviceOnHostC_float;
    initData(&initialC_float, &initialA_float, &initialB_float, &alpha_float,
        &beta_float, &referenceC_float, &deviceOnHostC_float);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_float, initialA_float, initialB_float,
        alpha_float, beta_float, referenceC_float, deviceOnHostC_float);
#else
    invalids = callLibrary(initialC_float, initialA_float, initialB_float, alpha_float,
        beta_float, referenceC_float, deviceOnHostC_float);
#endif
    destroyData(initialC_float, initialA_float, initialB_float,
        referenceC_float, deviceOnHostC_float);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_DOUBLE
  case enum_double: {
    double *initialC_double;
    double *initialA_double;
    double *initialB_double;
    double alpha_double;
    double beta_double;
    double *referenceC_double;
    double *deviceOnHostC_double;
    initData(&initialC_double, &initialA_double, &initialB_double,
        &alpha_double, &beta_double, &referenceC_double, &deviceOnHostC_double);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_double, initialA_double, initialB_double,
        alpha_double, beta_double, referenceC_double, deviceOnHostC_double);
#else
    invalids = callLibrary(initialC_double, initialA_double, initialB_double,
        alpha_double, beta_double, referenceC_double, deviceOnHostC_double);
#endif
    destroyData(initialC_double, initialA_double, initialB_double,
        referenceC_double, deviceOnHostC_double);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_TENSILECOMPLEXFLOAT
  case enum_TensileComplexFloat: {
    TensileComplexFloat *initialC_TCF;
    TensileComplexFloat *initialA_TCF;
    TensileComplexFloat *initialB_TCF;
    TensileComplexFloat alpha_TCF;
    TensileComplexFloat beta_TCF;
    TensileComplexFloat *referenceC_TCF;
    TensileComplexFloat *deviceOnHostC_TCF;
    initData(&initialC_TCF, &initialA_TCF, &initialB_TCF, &alpha_TCF,
        &beta_TCF, &referenceC_TCF, &deviceOnHostC_TCF);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_TCF, initialA_TCF, initialB_TCF, alpha_TCF,
        beta_TCF, referenceC_TCF, deviceOnHostC_TCF);
#else
    invalids = callLibrary(initialC_TCF, initialA_TCF, initialB_TCF, alpha_TCF,
        beta_TCF, referenceC_TCF, deviceOnHostC_TCF);
#endif
    destroyData(initialC_TCF, initialA_TCF, initialB_TCF, referenceC_TCF,
        deviceOnHostC_TCF);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_TENSILECOMPLEXDOUBLE
  case enum_TensileComplexDouble: {
    TensileComplexDouble *initialC_TCD;
    TensileComplexDouble *initialA_TCD;
    TensileComplexDouble *initialB_TCD;
    TensileComplexDouble alpha_TCD;
    TensileComplexDouble beta_TCD;
    TensileComplexDouble *referenceC_TCD;
    TensileComplexDouble *deviceOnHostC_TCD;
    initData(&initialC_TCD, &initialA_TCD, &initialB_TCD, &alpha_TCD,
        &beta_TCD, &referenceC_TCD, &deviceOnHostC_TCD);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_TCD, initialA_TCD, initialB_TCD, alpha_TCD,
        beta_TCD, referenceC_TCD, deviceOnHostC_TCD);
#else
    invalids = callLibrary(initialC_TCD, initialA_TCD, initialB_TCD, alpha_TCD, beta_TCD,
        referenceC_TCD, deviceOnHostC_TCD_TCD);
#endif
    destroyData(initialC_TCD, initialA_TCD, initialB_TCD, referenceC_TCD,
        deviceOnHostC_TCD);
    }
    break;
#endif
  default:
    break;
    // nothing

  }

  // cleanup
  destroyControls();
  std::cout << std::endl << "Fastest: " << fastestGFlops << " GFlop/s by (" << fastestIdx << ") ";
#if Tensile_CLIENT_BENCHMARK
  std::cout << solutionNames[fastestIdx];
#else
  std::cout << functionNames[fastestIdx];
#endif
  std::cout << std::endl;
  if (invalids) {
    printf("\nInvalid Solutions:\n");
    for (unsigned int i = 0; i < numInvalidSolutions; i++) {
      printf("[%2u] %s\n", invalidSolutions[i], solutionNames[invalidSolutions[i]]);
    }
    return EXIT_FAILURE;
  } else {
    return EXIT_SUCCESS;
  }
} // main



/*******************************************************************************
 * init controls
 ******************************************************************************/
void initControls() {
#if Tensile_RUNTIME_LANGUAGE_OCL<commit_msg>client prints num invalid solutions<commit_after>#include "Client.h"
#include <string>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <iomanip>

/*******************************************************************************
 * main
 ******************************************************************************/
int main( int argc, char *argv[] ) {
  if (sizeof(size_t) != 8) {
    std::cout << "WARNING: Executable not 64-bit." << std::endl;
  }

  // parse command line parameters
  parseCommandLineParameters(argc, argv);

  // init runtime controls
  initControls();

  // init data
  unsigned int dataTypeIdx = 0;
  DataTypeEnum dataTypeEnum = dataTypeEnums[dataTypeIdx];
  bool invalids;
  switch(dataTypeEnum) {
#ifdef Tensile_DATA_TYPE_FLOAT
  case enum_float: {
    float *initialC_float;
    float *initialA_float;
    float *initialB_float;
    float alpha_float;
    float beta_float;
    float *referenceC_float;
    float *deviceOnHostC_float;
    initData(&initialC_float, &initialA_float, &initialB_float, &alpha_float,
        &beta_float, &referenceC_float, &deviceOnHostC_float);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_float, initialA_float, initialB_float,
        alpha_float, beta_float, referenceC_float, deviceOnHostC_float);
#else
    invalids = callLibrary(initialC_float, initialA_float, initialB_float, alpha_float,
        beta_float, referenceC_float, deviceOnHostC_float);
#endif
    destroyData(initialC_float, initialA_float, initialB_float,
        referenceC_float, deviceOnHostC_float);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_DOUBLE
  case enum_double: {
    double *initialC_double;
    double *initialA_double;
    double *initialB_double;
    double alpha_double;
    double beta_double;
    double *referenceC_double;
    double *deviceOnHostC_double;
    initData(&initialC_double, &initialA_double, &initialB_double,
        &alpha_double, &beta_double, &referenceC_double, &deviceOnHostC_double);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_double, initialA_double, initialB_double,
        alpha_double, beta_double, referenceC_double, deviceOnHostC_double);
#else
    invalids = callLibrary(initialC_double, initialA_double, initialB_double,
        alpha_double, beta_double, referenceC_double, deviceOnHostC_double);
#endif
    destroyData(initialC_double, initialA_double, initialB_double,
        referenceC_double, deviceOnHostC_double);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_TENSILECOMPLEXFLOAT
  case enum_TensileComplexFloat: {
    TensileComplexFloat *initialC_TCF;
    TensileComplexFloat *initialA_TCF;
    TensileComplexFloat *initialB_TCF;
    TensileComplexFloat alpha_TCF;
    TensileComplexFloat beta_TCF;
    TensileComplexFloat *referenceC_TCF;
    TensileComplexFloat *deviceOnHostC_TCF;
    initData(&initialC_TCF, &initialA_TCF, &initialB_TCF, &alpha_TCF,
        &beta_TCF, &referenceC_TCF, &deviceOnHostC_TCF);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_TCF, initialA_TCF, initialB_TCF, alpha_TCF,
        beta_TCF, referenceC_TCF, deviceOnHostC_TCF);
#else
    invalids = callLibrary(initialC_TCF, initialA_TCF, initialB_TCF, alpha_TCF,
        beta_TCF, referenceC_TCF, deviceOnHostC_TCF);
#endif
    destroyData(initialC_TCF, initialA_TCF, initialB_TCF, referenceC_TCF,
        deviceOnHostC_TCF);
    }
    break;
#endif
#ifdef Tensile_DATA_TYPE_TENSILECOMPLEXDOUBLE
  case enum_TensileComplexDouble: {
    TensileComplexDouble *initialC_TCD;
    TensileComplexDouble *initialA_TCD;
    TensileComplexDouble *initialB_TCD;
    TensileComplexDouble alpha_TCD;
    TensileComplexDouble beta_TCD;
    TensileComplexDouble *referenceC_TCD;
    TensileComplexDouble *deviceOnHostC_TCD;
    initData(&initialC_TCD, &initialA_TCD, &initialB_TCD, &alpha_TCD,
        &beta_TCD, &referenceC_TCD, &deviceOnHostC_TCD);
#if Tensile_CLIENT_BENCHMARK
    invalids = benchmarkProblemSizes(initialC_TCD, initialA_TCD, initialB_TCD, alpha_TCD,
        beta_TCD, referenceC_TCD, deviceOnHostC_TCD);
#else
    invalids = callLibrary(initialC_TCD, initialA_TCD, initialB_TCD, alpha_TCD, beta_TCD,
        referenceC_TCD, deviceOnHostC_TCD_TCD);
#endif
    destroyData(initialC_TCD, initialA_TCD, initialB_TCD, referenceC_TCD,
        deviceOnHostC_TCD);
    }
    break;
#endif
  default:
    break;
    // nothing

  }

  // cleanup
  destroyControls();
  std::cout << std::endl << "Fastest: " << fastestGFlops << " GFlop/s by (" << fastestIdx << ") ";
#if Tensile_CLIENT_BENCHMARK
  std::cout << solutionNames[fastestIdx];
#else
  std::cout << functionNames[fastestIdx];
#endif
  std::cout << std::endl;
  if (invalids) {
    printf("\nInvalid Solutions: %u/%u\n", numInvalidSolutions, numSolutions);
    for (unsigned int i = 0; i < numInvalidSolutions; i++) {
      printf("[%2u] %s\n", invalidSolutions[i], solutionNames[invalidSolutions[i]]);
    }
    return EXIT_FAILURE;
  } else {
    return EXIT_SUCCESS;
  }
} // main



/*******************************************************************************
 * init controls
 ******************************************************************************/
void initControls() {
#if Tensile_RUNTIME_LANGUAGE_OCL
{'fraction_non_alphanumeric': 0.14621784450607248, 'fraction_numerical': 0.0011475566606101177, 'mean_word_length': 5.2510460251046025, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5905598', 'n_tokens_mistral': 3577, 'n_tokens_neox': 3500, 'n_words': 622}