コード例 #1
0
ファイル: guided_64.c プロジェクト: josh-gree/omp_final
int main(int argc, char *argv[]) { 

  double start1,start2,end1,end2;
  int r;

  init1(); 

  start1 = omp_get_wtime(); 

  for (r=0; r<reps; r++){ 
    loop1();
  } 

  end1  = omp_get_wtime();  


  double out1 = valid1();
  printf("%f,", (float)(end1-start1)); 


  init2(); 

  start2 = omp_get_wtime(); 

  for (r=0; r<reps; r++){ 
    loop2();
  } 

  end2  = omp_get_wtime(); 


  double out2 = valid2();
  printf("%f,guided,64,%.10f,%.10f\n", (float)(end2-start2), out1, out2); 

} 
コード例 #2
0
void Syncdb::bigLoop ( ) {
	// try to launch our sync
	if ( m_doRcp ) rcpFiles();
	// we got a msg0 or msg5 outstanding. wait for it to come back first.
	if ( m_outstanding ) return;
	if ( ! m_calledLoop1 ) { loop1(); return; }
	if ( ! m_calledLoop2 ) { loop2(); return; }
	if ( ! m_calledLoop3 ) { loop3(); return; }
	if ( ! m_calledLoop4 ) { loop4(); return; }
	if ( ! m_calledLoop5 ) { loop5(); return; }
	// if done calling loop4(), reset this
	loopReset();
}
コード例 #3
0
ファイル: loops.c プロジェクト: IDA-RE-things/ida-decompiler
int main(int argc, char *argv[])
{
    loop0();
    loop1();
    loop2();
    loop3();
    loop4();
    loop5();
    loop6();
    loop7();
    loop8();
    loop9();
    loop10();
}
コード例 #4
0
int main(int argc, char *argv[])
{
   SDL_Init(SDL_INIT_EVERYTHING);
   SDL_SetVideoMode(600, 400, 32, SDL_SWSURFACE);

   emscripten_run_script("keydown(37);"); // left
   result += loop1();
   emscripten_run_script("keydown(39);"); // right
   result += loop2();
   emscripten_run_script("keydown(65);"); // A
   result += alphakey();
   REPORT_RESULT(result);
   return 0;
}
コード例 #5
0
ファイル: felix.c プロジェクト: PersistingVoices/HPC-C
int main(int argc, char *argv[]) {
    FILE *pFile;

    double start1,start2,end1,end2,time1,time2;
    int r;

    init1();

    start1 = omp_get_wtime();

    for (r=0; r<reps; r++){
        loop1();
    }

    end1  = omp_get_wtime();

    valid1();
    time1 = (float)(end1-start1);
    printf("Total time for %d reps of loop 1 = %f\n",reps, time1);

    pFile = fopen ("myfile.txt" , "w");
    if (pFile == NULL) perror ("Error opening file");

    init2();

    start2 = omp_get_wtime();

    for (r=0; r<reps; r++){
        loop2();
    }

    end2  = omp_get_wtime();

    valid2();

    time2 = (float)(end2-start2);
    printf("Total time for %d reps of loop 2 = %f\n",reps, time2);
    printf("This file is functional\n");
    fprintf(pFile,"%lf\t%lf\n",time1, time2);
    fclose(pFile);
}
コード例 #6
0
ファイル: testTrace.C プロジェクト: jimix/k42
int main()
{
  unsigned long long i;
  unsigned long long int sum = 0;
  unsigned long long int count;


  count = 4;

  TraceOSDbgEvent2Start(1, 2);
  for (i = 0; i < count; i++) {
      TraceOSDbgd1A(1);
      sum+=loop1();
      TraceOSDbgd2A(2, 3);
      sum+=loop2();
      TraceOSDbgd3A(4, 5, 6);
  }
  TraceOSDbgEvent2End(3, 4);

  return 0;
}
コード例 #7
0
ファイル: loop_static_16.c プロジェクト: bluefeet32/labs
int main(int argc, char *argv[]) { 

  double start1,start2,end1,end2;
  int r;

  init1(); 

  start1 = omp_get_wtime(); 


		for (r=0; r<reps; r++){ 
			loop1();
		} 

  end1  = omp_get_wtime();  

  valid1(); 

  printf("Total time for %d reps of loop 1 = %f\n",reps, (float)(end1-start1)); 


  init2(); 

  start2 = omp_get_wtime(); 


  for (r=0; r<reps; r++){ 
    loop2();
  } 

  end2  = omp_get_wtime(); 

  valid2(); 

  printf("Total time for %d reps of loop 2 = %f\n",reps, (float)(end2-start2)); 

} 
コード例 #8
0
ファイル: main.c プロジェクト: tzxl10000/FWMAV_code-backup
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
	
	//SysTick_Config(SystemCoreClock/1000); //1ms interrupt capture
	counter_sweep=0;
	/*************Variable Initializations*****************/
	/*Example 3600/2=1800-->40K, 3600/3.6=100-->72K, 3600/4=900-->80K, 3600/5=720-->100K*/
	PWM_cycle =900; 
	
	MotorV=16.0f; //(V), motor voltage, now 13.0V power source
	
	Ts1=0.001f; //sec, for loop1, 1KHz
	Ts2=0.01f;  //sec, for loop2, 100Hz
	time1=0.0f;
	time2=0.0f;
	
	pi=3.14159265f;
	two_pi=6.2831853f;
	Kc2r=two_pi/2560.0f; //ENCODER RESOLUTION,	floating in 32*4*10
	
	freq=34.0f;	//Hz, flapping frequency	 34.0HZ
	two_pi_freq=two_pi*freq;
	
	Vin1=0;
	Vin2=0;
	Ddirect1=1;
	Ddirect2=1;
	Hall_1=0x05;
	Hall_2=0x05;
	Hall_State1=1;
	Hall_State2=1;
	
	Encoder1=0;
	Encoder2=0;
	
	y1=0.0f; 
	y1_dot=0.0f;
	y1_ddot=0.0f;
	y1_save=0.0f;
	
	y2=0.0f;
	y2_dot=0.0f;
	y2_ddot=0.0f;
	y2_save=0.0f;

	yd1=0.0f;
	yd1_dot=0.0f;
	yd1_ddot=0.0f;
	
	yd2=0.0f;
	yd2_dot=0.0f;
	yd2_ddot=0.0f; 

	e1=0.0f;
	e1_dot=0.0f;
	e1_int=0.0f;
	
	e2=0.0f;
	e2_dot=0.0f;
	e2_int=0.0f;
	
	flap1=0.0f;
	d_flap1=0.0f;
	sigma1=0.5f;
	phase1=0.0f;
	
	flap2=0.0f;
	d_flap2=0.0f;
	sigma2=0.5f;
	phase2=0.0f;
	
/******* body stabilization *******/	
  flap_cycle_flag=0;
	Kp_rol=0.1f; //10deg->0.5V
	Kd_rol=0.0017f;  //20deg/s->0.5V

	Kp_pit=2.0f; //10deg->2V
	Kd_pit=0.001f; //20deg/s->1V
	
	Kp_yaw=0.0f; //10
	Kd_yaw=0.0f; //100
	
	delta_Amp=0.0f; 
	delta_Spl=0.0f;
	delta_Bia=0.0f;
	
	/*!!!!!!!!!!!!!! trim condition!!!!!!!!!!!!!!!!!!!*/	
	//left motor is motor 1, looking at the front of motor board
	trim_A1 = 16.00f; //(V), value at 12V nominal and 13V power source
	//right motor is motor 2, looking at the front of motor board
	trim_A2 = 16.00f; //(V), value at 12V nominal and 13V power source
	
#if WING_KINEMATICS
	flap1=0.0f*KGR;	// rad 30
	d_flap1=0.0f/180.0f*pi; // rad
	sigma1=0.5f;
	phase1=0.0f;
	
	flap2=0.0f*KGR; // rad 30
	d_flap2=0.0f/180.0f*pi; // rad
	sigma2=0.5f;
	phase2=0.0f;
	
	//////////////PID Parameters//////////250/
//	Kp=38.8974f;
//	Kd=0.1338f;
//	Ki=6028.3f;
//  Ku = 9.16732471506f;
//	Kp = 16.10f;
//	Ki = 0.0f;//550.0f;
//	Kd = 0.001f;
//	Ku=0.0f;
//	Kp = 0.0f;
//	Ki = 0.0f;
//	Kd = 0.0f;
	//////////////PID Parameters//////////200/
	//Kp=21.5359f;
	//Kd=0.1049f;
	//Ki=3086.5f;

  /*******LQR Parameters********/
	Kss1=0.00015;
	Kss2=0.012;
	Fss1=6.1690; //6.1690
	Fss2=7.6461; //7.6461
//	/*******LQR Parameters********/
//	Kss1=0.0001;
//	Kss2=0.0117;
//	Fss=8.1690;
/******* body stabilization *******/

	Kp_rol=3.0f/180.0f*pi; //10deg->5deg in rad
	Kd_rol=0.0018f; //10deg->5deg in rad

	Kp_pit=5.0f/180.0f*pi/10.0f; //10deg->5deg in rad
	Kd_pit=0.0f; //10deg->5deg in rad
	
	Kp_yaw=0.0f; //10
	Kd_yaw=0.0f; //100
	
	delta_Amp=0.0f; 
	delta_Spl=0.0f;
	delta_Bia=0.0f;


	//left motor is motor 1, looking at the front of motor board
	trim_A1 = 45.0f/180.0f*pi; //(deg)
	//right motor is motor 2, looking at the front of motor board
	trim_A2 = 45.0f/180.0f*pi; //(deg)
	
#endif

	//TO DO:
	trim_Bia1=0.0f;  ////////(pitch) trim bias 
	trim_Bia2=0.0f;
	//TO DO:
	trim_Spl1=0.0f;
	trim_Spl2=0.0f;

	/**********ENCODER Configuration***********/
	#if QEI_DEF
  Timer1_Encoder1();
	Timer4_Encoder2();

	/* ENCODER COUNTER # RESET */
	TIM_SetCounter(TIM1,0); //TIM4->CNT = 0; Encoder1 counts reset
	TIM_SetCounter(TIM4,0); //TIM4->CNT = 0; Encoder2 counts reset
  #endif
	
	#if SERIAL_COM
	serial_flag=0;
	tx_index = 0;
  rx_index = 0;
	Usart3_Configuration();
	#endif
	
	#if I2C_IMU
		 MPU9150_Init();
	#endif
	
	/* gpio Configuration */
  GPIO_Config(); //define GPIO & PWM with timerS
	

	 /*************Loop Initializations*****************/
	LOOP1_flag=0;
	LOOP2_flag=0;

	/*************PWM Initializations*****************/
	//DISABLE DRIVE BY DIAG_EN SET 0
	GPIO_WriteBit(GPIOB,   GPIO_Pin_2 , Bit_RESET);//TEST PIN RESET
	GPIO_WriteBit(GPIOC,   GPIO_Pin_13, Bit_RESET); // Bit-SET = high, bit-reset = low
	
	Timer3_PWM1(PWM_cycle); // PWM Driver Input 1
	Timer2_PWM2(PWM_cycle); // PWM Driver Input 2	
	PWM1_Set_SingleEdge( 0, 0, 0);
	PWM2_Set_SingleEdge( 0, 0, 0);
	
	
	/*************Wait 5sec for setup****************/
	delay_ms(5000);  //TICKER MIGHT BE A BETTER WAY
	
	/*************Timer Initializations****************/
	Timer7_Looptimer1_Int(LOOP0_STEP_SIZE);
	
#if TIM_LOOP1
	Timer15_Looptimer2_Int(LOOP1_STEP_SIZE);
	time1=0.0;
#endif

#if TIM_LOOP2	
	Timer16_Looptimer3_Int(LOOP2_STEP_SIZE);
	time2=0.0;
#endif	

/********** Enable drive**************/
//	DLAG/EN1	:: 20 :: PB2
//	DLAG/EN2 	:: 02 :: PC13
	GPIO_WriteBit(GPIOB,   GPIO_Pin_2 , Bit_SET);//TEST PIN RESET
	GPIO_WriteBit(GPIOC,   GPIO_Pin_13, Bit_SET); // Bit-SET = high, bit-reset = low
  /* Infinite loop */
  while (1)
  {
		
	//Encoder1= TIM_GetCounter(TIM1); //////////Encoder1 test, get position; TIMx->CNT;
	//Encoder2= TIM_GetCounter(TIM4); //Encoder2 test, get position; TIMx->CNT; takes 10us
	//PWM1_Set_SingleEdge(0,Vin1,0); //////////PWM test
  //PWM2_Set_SingleEdge(0,Vin2,0); //////////PWM test

			if(LOOP1_flag) 
				loop1();			 
			if(LOOP2_flag) 
				loop2();
//	PWM1_Set_SingleEdge(Vin1,Vin1,Vin1); //////////PWM test
//  PWM2_Set_SingleEdge(Vin2,Vin2,Vin2); //////////PWM test
//			printf("%d \r\n", Encoder1);
		
	}
}
コード例 #9
0
ファイル: GUIDED64.c プロジェクト: PersistingVoices/HPC-C
int main(int argc, char *argv[]) { 
	FILE *pFile2,*pFile1;
	FILE *pipe_gp1;

	double start1,start2,end1,end2,time1,time2;
	int r,i=0,rand(void);

	pFile1 = fopen ("Data/GUIDED-n-file1.dat" , "w");
	pFile2 = fopen ("Data/GUIDED-n-file2.dat" , "w");

	if (pFile1 == NULL || pFile2 ==NULL) perror ("Error opening file");

	for(i=0;i<100;i++)
	{
		init1(); 
		start1 = omp_get_wtime(); 
		for (r=0; r<reps; r++){ 
			loop1();
		} 
		end1  = omp_get_wtime();  

		valid1(); 
		time1 = (float)(end1-start1);
		//printf("Total time for %d reps of loop 1 = %f\n",reps, time1); 


		init2(); 
		start2 = omp_get_wtime(); 
		for (r=0; r<reps; r++){ 
			loop2();
		} 
		end2  = omp_get_wtime(); 

		valid2(); 
		time2 =  (float)(end2-start2);
		// printf("Total time for %d reps of loop 2 = %f\n",reps, time2);
		// printf("This file is functional\n");

		// Write everything in the file, before plotting. 
		fprintf(pFile1,"%lf\t%d\t%lf\n",(i+1)*time1,i+1,time1);
		fprintf(pFile2,"%lf\t%d\t%lf\n",(i+1)*time2,i+1,time2); 
	}
	printf("\n\t\t\tWritten to 'GUIDED-n-file1.dat & GUIDED-n-file2.dat'\n\n"); 
	fclose(pFile1);
	fclose(pFile2);

	// Gnu-plot script
	pipe_gp1 = popen("gnuplot","w");
	fputs("set terminal wxt 0\n ", pipe_gp1);
	fputs("unset key\n ", pipe_gp1);
	fputs("set hidden3d\n ", pipe_gp1);
	fputs("set dgrid3d 50,50\n ", pipe_gp1);
	fputs("set title '3DPlot1'\n ", pipe_gp1);
	fputs("set xlabel'Random Axis Arrangement (for 3-d plot)'\n ", pipe_gp1);
	fputs("set ylabel 'Iteration Number'\n ", pipe_gp1);
	fputs("set zlabel 'Time taken for 100 iterations'\n ", pipe_gp1);
	fputs("splot 'Data/GUIDED-n-file1.dat' u 1:2:3 w lines \n ", pipe_gp1);
	fputs("set terminal png  size 1200,800\n ", pipe_gp1); 
	fputs("set output 'Plots/GUIDED-n-3dplot1.png'\n ", pipe_gp1);
	fputs("replot\n ", pipe_gp1);


	fputs("reset\n ", pipe_gp1);

	fputs("set terminal wxt 0\n ", pipe_gp1);
	fputs("unset key\n ", pipe_gp1);
	fputs("set title '2DPlot1'\n ", pipe_gp1);
	fputs("set xlabel 'Iteration Number'\n ", pipe_gp1);
	fputs("set ylabel 'Time taken for 100 iterations'\n ", pipe_gp1);
	fputs("plot 'Data/GUIDED-n-file1.dat' u 2:3 w lines \n ", pipe_gp1);
	fputs("set terminal png  size 1200,800\n ", pipe_gp1); 
	fputs("set output 'Plots/GUIDED-n-2dplot1.png'\n ", pipe_gp1);
	fputs("replot\n ", pipe_gp1);

	fputs("reset\n ", pipe_gp1);

	fputs("set terminal wxt 0\n ", pipe_gp1);
	fputs("unset key\n ", pipe_gp1);
	fputs("set hidden3d\n ", pipe_gp1);
	fputs("set dgrid3d 50,50\n ", pipe_gp1);
	fputs("set title 'Plot2'\n ", pipe_gp1);
	fputs("set xlabel'Random Axis Arrangement (for 3-d plot)'\n ", pipe_gp1);
	fputs("set ylabel 'Iteration Number'\n ", pipe_gp1);
	fputs("set zlabel 'Time taken for 100 iterations'\n ", pipe_gp1);
	fputs("splot 'Data/GUIDED-n-file2.dat' u 1:2:3 w lines \n ", pipe_gp1);
	fputs("set terminal png  size 1200,800\n ", pipe_gp1); 
	fputs("set output 'Plots/GUIDED-n-3dplot2.png'\n ", pipe_gp1);
	fputs("replot\n ", pipe_gp1);

	fputs("reset\n ", pipe_gp1);

	fputs("set terminal wxt 0\n ", pipe_gp1);
	fputs("unset key\n ", pipe_gp1);
	fputs("set title '2DPlot1'\n ", pipe_gp1);
	fputs("set xlabel 'Iteration Number'\n ", pipe_gp1);
	fputs("set ylabel 'Time taken for 100 iterations'\n ", pipe_gp1);
	fputs("plot 'Data/GUIDED-n-file2.dat' u 2:3 w lines \n ", pipe_gp1);
	fputs("set terminal png  size 1200,800\n ", pipe_gp1); 
	fputs("set output 'Plots/GUIDED-n-2dplot2.png'\n ", pipe_gp1);
	fputs("replot\n ", pipe_gp1);

	pclose(pipe_gp1);

	printf("\n\t\t\tPlots at 'GUIDED-n-plot1.png & GUIDED-n-plot2.png' for loop1 & loop2  (100I)\n\n"); 
}