Пример #1
0
/* MAIN PROGRAM */
int main(int argc, char *argv[]){
    
    // display LOGO --- LOL    
    int i=0;
    while (logo[i] != NULL){ 
        printf("%s", logo[i++]);
    }

    // Store runtime 
    struct timeval tim;
    gettimeofday(&tim, NULL);
    timing_initial = tim.tv_sec+(tim.tv_usec/1000000.0);
    
    // initialiase  interrupts, random numbers, problem, etc
    signal(SIGINT, interruptHandler);
    signal(SIGKILL, interruptHandler);
    srand(tim.tv_usec + getpid());

    /* -------------------- */

    problem_init(argc, argv);
   
    while(1){
        iterate();
    }

    return 0;
}
Пример #2
0
int main(int argc, char *argv[]){

  problem_init();

  glutInit(&argc, argv);
  /* glutInitDisplayMode(GLUT_RGBA); */
  glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
  glutInitWindowPosition(100,100);
  glutInitWindowSize(glwidth,glheight);
  /* glutInitWindowSize(WINWIDTH, WINHEIGHT); */
  glutCreateWindow("tree collision detection");

  glutKeyboardFunc(keyboard);
  glutJoystickFunc(joystick, 10);
  glutMouseFunc(mouse);
  glutMotionFunc(mousemove);

  glutDisplayFunc(display);
  glutIdleFunc(iterate);
  init();
  /*   glutReshapeFunc(reshape); */
  glClearColor(0.0f, 0.0f, .5f, 0.0f);
  glClearDepth(1.0f);

  glutMainLoop();

  return 0;
}
Пример #3
0
int main(int argc, char* argv[]) {
  srand(time(NULL));
  problem_init(argc, argv);
  boxsize_max = boxsize_x;
  if(boxsize_max < boxsize_y) boxsize_max = boxsize_y;
  if(boxsize_max < boxsize_z) boxsize_max = boxsize_z;
  boxsize_min = boxsize_x;
  if(boxsize_y < boxsize_min) boxsize_min = boxsize_y;
  if(boxsize_z < boxsize_min) boxsize_min = boxsize_z;
  problem_output();
  init_display(argc, argv);

  while(t < tmax || tmax == 0.0) {
    iterate();
  }

  printf("Computation finished\n");
  return 0;
}
Пример #4
0
void test_forest_serialization() {
    test_header();

    ET_problem prob;
    ET_params params;
    ET_forest *forest, *forest2;
    uchar_vec buffer;
    unsigned char *mobile_buffer;
    float vector[] = {3, 1, 1, 6, 6, 2};

    kv_init(buffer);
    problem_init(&prob, big_vectors, big_labels);

    EXTRA_TREE_DEFAULT_REGR_PARAMS(prob, params);
    params.number_of_trees = 100;
    params.number_of_features_tested = 1;
    params.select_features_with_replacement = true;

    forest = ET_forest_build(&prob, &params);
    ET_forest_dump(forest, &buffer, true);
    fprintf(stderr, "forest dump: %zu bytes\n", kv_size(buffer));

    mobile_buffer = buffer.a;
    forest2 = ET_forest_load(&mobile_buffer);
    forest2->params = forest->params; // FIXME

    fprintf(stderr, "orig   forest pred: %g\n",
        ET_forest_predict(forest, vector));
    fprintf(stderr, "cloned forest pred: %g\n",
        ET_forest_predict(forest2, vector));

    kv_destroy(buffer);
    ET_forest_destroy(forest);
    ET_forest_destroy(forest2);
    free(forest);
    free(forest2);
}
Пример #5
0
int main(int argc, char* argv[]) {
#ifdef MPI
	communication_mpi_init(argc,argv);
	// Print logo only on main node.
	if (mpi_id==0){
#endif // MPI
		int i=0;
		while (logo[i]!=NULL){ printf("%s",logo[i++]); }
#ifdef MPI
		printf("Using MPI with %d nodes.\n",mpi_num);
	}
	MPI_Barrier(MPI_COMM_WORLD);
#endif // MPI
#ifdef OPENMP
	printf("Using OpenMP with %d threads per node.\n",omp_get_max_threads());
#endif // OPENMP
	// Store time to calculate total runtime.
	struct timeval tim;
	gettimeofday(&tim, NULL);
	timing_initial = tim.tv_sec+(tim.tv_usec/1000000.0);
	// Initialiase interrupts, random numbers, problem, box and OpengL
	signal(SIGINT, interruptHandler);
	signal(SIGKILL, interruptHandler);
	srand ( tim.tv_usec + getpid());
	problem_init(argc, argv);
	problem_output();
#ifdef OPENGL
	display_init(argc, argv);
#else // OPENGL
	while(1){
		// Main run loop.
		iterate();
	}
#endif // OPENGL
	return 0;
}