예제 #1
0
void standard_dimensions_broadcast ( int myid, int *nbequ, int *nbvar )
{
   int fail,m;

   if(v>0) printf("Node %d has entered dimensions_broadcast.\n", myid);

   MPI_Bcast(nbequ,1,MPI_INT,0,MPI_COMM_WORLD);  
   MPI_Bcast(nbvar,1,MPI_INT,0,MPI_COMM_WORLD);  

   if(myid != 0)
   {
      if(v>0) 
      {
          printf("Node %d has the number of equations as %d.\n", myid, *nbequ);
          printf("Node %d has the number of variables as %d.\n", myid, *nbvar);
      }
      /* initialize container */
      fail = syscon_initialize_number_of_standard_polynomials(*nbequ);
      if(v>0)
      {  /* get dimension as test */
         fail = syscon_number_of_standard_polynomials(&m);
         printf("  and initialized container with dimension %d.\n", m);
      }
   }

   if(v>0) printf("Node %d is leaving dimensions_broadcast.\n", myid);
}
예제 #2
0
int standard_polysys_solver ( void )
{
   int fail,nbq,nbtasks,topdim,filter,factor,verbose;

   fail = syscon_read_standard_system();
   fail = syscon_number_of_standard_polynomials(&nbq);
   printf("-> read %d polynomials\n", nbq);
   printf("\n");
   read_solver_options(&nbtasks,&topdim,&filter,&factor,&verbose);

   printf("\nCalling the solver ...\n\n");
   fail = standard_polysys_solve(nbtasks,topdim,filter,factor,verbose);
   fail = standard_polysys_write(topdim);

   return fail;
}
예제 #3
0
void print_monomials ( void ) 
{
   int *d,i,j,k,n,mm,fail;
   double c[2];

   fail = syscon_number_of_standard_polynomials(&n);

   d = (int*)calloc(n,sizeof(int));

   for(i=1; i<=n; i++)
   {
      fail = syscon_number_of_standard_terms(i,&mm);
      printf("Polynomial %d has %d monomials :\n",i,mm);
      for(j=1; j<=mm; j++)
      {
         fail = syscon_retrieve_standard_term(i,j,n,d,c);
         printf(" %.15e  %.15e",c[0],c[1]);
         for(k=0; k<n; k++) printf(" %d",d[k]);
         printf("\n");
      }
   }
}
예제 #4
0
void dimension_broadcast ( int myid, int *n )
{
   int fail,m;

   if(v>0) printf("Node %d has entered broadcast_dimension.\n", myid);

   MPI_Bcast(n,1,MPI_INT,0,MPI_COMM_WORLD);  

   if(myid != 0)
   {
      if(v>0) printf("Node %d knowns that the dimension is %d\n", myid, *n);
      /* initialize container */
      fail = syscon_initialize_number_of_standard_polynomials(*n);
      if(v>0)
      {  /* get dimension as test */
         fail = syscon_number_of_standard_polynomials(&m);
         printf("  and initialized container with dimension %d.\n", m);
      }
   }

   if(v>0) printf("Node %d is leaving broadcast_dimension.\n", myid);
}
예제 #5
0
int standard_run ( int myid, int nbrp, int nbc, char* outfile, int verbose )
{
   int fail,dim,nbsols,mysolnum,len,*nbpaths;
   double startwtime,endwtime,wtime,*time;

   startwtime = MPI_Wtime();
   if(myid == 0)
   {
      time = (double*)calloc(nbrp,sizeof(double));
      nbpaths = (int*)calloc(nbrp,sizeof(int));
      fail = read_target_system_without_solutions();
      fail = copy_target_system_to_container();
      fail = syscon_number_of_standard_polynomials(&dim);
      fail = write_standard_target_system(); // writes to file
   }
   standard_dimensions_broadcast(myid,&dim,&dim);

   if(verbose > 0) printf("Process %d has dimension %d.\n",myid,dim);

   monomials_broadcast(myid,dim); // broadcast target system

   if(myid != 0) fail = copy_container_to_target_system();

   if(verbose > 0)
      if(myid == 1) fail = write_standard_target_system();

   if(myid == 0)
   {
      fail = read_standard_start_system();
      fail = copy_start_system_to_container();
      fail = write_standard_start_system(); // writes to file
      fail = write_start_solutions(); // writes solutions to file
      fail = copy_start_solutions_to_container();
      fail = solcon_number_of_standard_solutions(&nbsols);
      if(verbose>0) printf("Read %d start solutions.\n",nbsols);
   }
   else
      fail = syscon_initialize_number_of_standard_polynomials(dim);

   monomials_broadcast(myid,dim); // broadcast start system

   if(myid != 0) fail = copy_container_to_start_system();

   if(verbose > 0)
      if(myid == 1) fail = write_standard_start_system();

   parameters_broadcast(myid,nbrp,verbose);

   if(myid == 0) verbose = prompt_for_verbose();
   MPI_Barrier(MPI_COMM_WORLD);

   MPI_Bcast(&verbose,1,MPI_INT,0,MPI_COMM_WORLD);

   MPI_Bcast(&nbsols,1,MPI_INT,0,MPI_COMM_WORLD);
   solutions_distribute(myid,nbsols,dim,nbrp,&mysolnum);

   fail = solcon_number_of_standard_solutions(&len);
   if(verbose > 0) printf("Node %d has %d solutions.\n",myid,len);

   if(myid > 0)
   {
      fail = copy_container_to_start_solutions();
      fail = standard_track_paths(myid,nbrp,nbc,outfile,verbose);
   }
   MPI_Barrier(MPI_COMM_WORLD);
   solutions_collect(myid,nbsols,dim,nbrp,mysolnum);

   if(myid == 0)
   {
      fail = copy_container_to_target_solutions();
      fail = write_target_solutions();
   }
   endwtime = MPI_Wtime();
   wtime = endwtime-startwtime;
   MPI_Gather(&wtime,1,MPI_DOUBLE,time,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
   MPI_Gather(&mysolnum,1,MPI_INT,nbpaths,1,MPI_INT,0,MPI_COMM_WORLD);

   if(myid == 0)
   {
      nbpaths[0] = nbsols;
      write_time_and_paths_to_defined_output_file(nbrp,time,nbpaths);
      free(time); free(nbpaths);
   }
   return 0;
}