void main(int argc, char ** argv)
{
	SQLHANDLE	henv;
	SQLHANDLE	hdbc;
	SQLHANDLE	hstmt;

	char	username[256];
	char	password[256];
	char	datasource[256];
	unsigned int		i,
		j;
  
	char	TableName[50];

	strcpy(datasource, "SQLServer Express");
	//strcpy(datasource, "Microsoft SQL Server");
	strcpy(username, "test");
	strcpy(password, "test");
	strcpy(TableName, "EMPLOYEES_PERFTEST");


  
/*	if (argc < 2) {
		fprintf (stderr, "Usage: ODBCBatchUpdates username/password@datasource\n\n");
		exit(255);
	}
*/

/*	if (getLoginInfo(argv[1], username, password, datasource) != SQL_SUCCESS) {
		fprintf (stderr, "Error: ' %s ' invalid login\n", argv[1]);
		fprintf (stderr, "Usage: ODBCBatchInserts username/password@datasource\n\n");
		exit(255);
	}
*/  
	printf("ODBC BATCH UPDATE TEST\n\n");

	InitODBCEnv(&henv);
	ODBCConnect(henv, &hdbc, username, password, datasource);
	InitODBCStmt(hdbc, &hstmt);

	printf("\nSETTING UP ENVIRONMENT\n");
	printf("Dropping table: %s\n", TableName);
	DropTable(hstmt, TableName);

	printf("Creating table: %s\n", TableName);
	CreateTable(hstmt, TableName);

	printf("Filling table: %s\n", TableName);
	BatchInsert(hdbc, hstmt, TableName, 100, 5000);

	/*	printf("\n\n");
	printf ("Deleting contents of table");
	ClearTable(hstmt, TableName);
	*/
	printf("\n\n");
	PrintTableHeader();

	for (i = 0; i < BatchSizeLen; i++) {
		for (j = 0; j < NumRecUpdatedLen; j++) {
            BatchUpdate(hdbc, hstmt, TableName, BatchSize[i], NumRecUpdated[j]);
			printf("	resetting test...");
			ClearTable(hstmt, TableName);
			BatchInsert(hdbc, hstmt, TableName, 100, 5000);
			printf("done\n");
		}
		printf ("\n");
	}

    Terminate(henv, hdbc, hstmt);

	printf("ODBC BATCH UPDATE TEST COMPLETED.\n\n");
	printf("===========================================================\n");
	printf("Press ENTER to end program...");
	getchar();

}
Exemple #2
0
void Client<T,U>::PerformanceTest(Arguments<U> &args, const SetMetric set_sizes) {

  // Prints the header of the output table
  PrintTableHeader(args);

  // Initializes OpenCL and the libraries
  auto platform = Platform(args.platform_id);
  auto device = Device(platform, args.device_id);
  auto context = Context(device);
  auto queue = Queue(context, device);
  #ifdef CLBLAST_REF_CLBLAS
    if (args.compare_clblas) { clblasSetup(); }
  #endif

  // Iterates over all "num_step" values jumping by "step" each time
  auto s = size_t{0};
  while(true) {

    // Sets the buffer sizes (routine-specific)
    set_sizes(args);

    // Populates input host matrices with random data
    std::vector<T> x_source(args.x_size);
    std::vector<T> y_source(args.y_size);
    std::vector<T> a_source(args.a_size);
    std::vector<T> b_source(args.b_size);
    std::vector<T> c_source(args.c_size);
    std::vector<T> ap_source(args.ap_size);
    std::vector<T> scalar_source(args.scalar_size);
    PopulateVector(x_source);
    PopulateVector(y_source);
    PopulateVector(a_source);
    PopulateVector(b_source);
    PopulateVector(c_source);
    PopulateVector(ap_source);
    PopulateVector(scalar_source);

    // Creates the matrices on the device
    auto x_vec = Buffer<T>(context, args.x_size);
    auto y_vec = Buffer<T>(context, args.y_size);
    auto a_mat = Buffer<T>(context, args.a_size);
    auto b_mat = Buffer<T>(context, args.b_size);
    auto c_mat = Buffer<T>(context, args.c_size);
    auto ap_mat = Buffer<T>(context, args.ap_size);
    auto scalar = Buffer<T>(context, args.scalar_size);
    x_vec.Write(queue, args.x_size, x_source);
    y_vec.Write(queue, args.y_size, y_source);
    a_mat.Write(queue, args.a_size, a_source);
    b_mat.Write(queue, args.b_size, b_source);
    c_mat.Write(queue, args.c_size, c_source);
    ap_mat.Write(queue, args.ap_size, ap_source);
    scalar.Write(queue, args.scalar_size, scalar_source);
    auto buffers = Buffers<T>{x_vec, y_vec, a_mat, b_mat, c_mat, ap_mat, scalar};

    // Runs the routines and collects the timings
    auto timings = std::vector<std::pair<std::string, double>>();
    auto ms_clblast = TimedExecution(args.num_runs, args, buffers, queue, run_routine_, "CLBlast");
    timings.push_back(std::pair<std::string, double>("CLBlast", ms_clblast));
    if (args.compare_clblas) {
      auto ms_clblas = TimedExecution(args.num_runs, args, buffers, queue, run_reference1_, "clBLAS");
      timings.push_back(std::pair<std::string, double>("clBLAS", ms_clblas));
    }
    if (args.compare_cblas) {
      auto ms_cblas = TimedExecution(args.num_runs, args, buffers, queue, run_reference2_, "CPU BLAS");
      timings.push_back(std::pair<std::string, double>("CPU BLAS", ms_cblas));
    }

    // Prints the performance of the tested libraries
    PrintTableRow(args, timings);

    // Makes the jump to the next step
    ++s;
    if (s >= args.num_steps) { break; }
    args.m += args.step;
    args.n += args.step;
    args.k += args.step;
    args.a_ld += args.step;
    args.b_ld += args.step;
    args.c_ld += args.step;
  }

  // Cleans-up and returns
  #ifdef CLBLAST_REF_CLBLAS
    if (args.compare_clblas) { clblasTeardown(); }
  #endif
}
Exemple #3
0
int main (void)
{
   
   int length = 0;
   int width  = 0;     
   int i      = 0;     
   int rectangleList[NUMRECTANGLES][NUMATTRIBUTES];
   

   PrintGreeting();

   /* Get input from user */

   printf("Please enter the length and width of ");
   printf("%d", NUMRECTANGLES);
   printf(" rectangles\n");
   printf("in the form of length, width (number comma number)\n");
   printf("- one pair on each line\n\n");
   
   /* Read in the length and width values for each rectangle */
   /* Store each value in an element of a 2-dimensional array */
   
   for (i = 0; i < NUMRECTANGLES; i++)
   {
      /* Read length and width and store in array  */
      scanf ("%d,%d", &length, &width);

      rectangleList[i][LENGTH] = length;
      rectangleList[i][WIDTH] = width;


      /******************** STEP 3  ***********************
       * Write a couple lines of code to calculate the    *
       * perimeter and area of the current rectangle,     *
       * and store the perimeter and area in elements 2   *
       * and 3 of the second dimension of the array.      *
       *                                                  *
       * Use the CalculatePerimeter and CalculateArea     *
       * functions from geometry.h                        *
       ***************************************************/
      rectangleList[i][PERIMETER] = CalculatePerimeter(length, width);
      rectangleList[i][AREA] = CalculateArea(length, width);

   }
    
   printf("\nThe properties of the rectangle(s) are:\n\n");

   /* The header for a results table */
   PrintTableHeader();

   /* Print out the length, width, perimeter and area of each rectangle */
   /* Print one per line */

   /******************* STEP 2 ***************************
    * Uncomment the following statement to call the      *
    * function which actually print out a table based on *
    * the values in our array.                           *
    *                                                    *
    * Note that we are PASSING the array here!           *
    *****************************************************/
   
   
     PrintRectangleTable( rectangleList, NUMRECTANGLES );
   
   
   printf("\n");

   return 0;
}