Пример #1
0
int start_system_broadcast ( int myid, int n, int *nbsols )
{
   int fail;

   if(myid == 0)                           /* manager reads start system */
   {
      fail = read_standard_start_system();
      fail = copy_start_system_to_container();
      fail = copy_start_solutions_to_container();
   }
   else
      /* initialize system container */
      fail = syscon_initialize_number_of_standard_polynomials(n);

   monomials_broadcast(myid,n);            /* broadcast container */

   if(myid != 0)                           /* copy result of broadcast */
   {
      fail = copy_container_to_start_system();
      fail = syscon_clear_standard_system(); /* clear system container */
   }
   else
      fail = solcon_number_of_standard_solutions(nbsols);

   return fail;
}
Пример #2
0
void test_validate ( void )
{
   int fail;

   printf("\nCalling Newton validation in PHCpack...\n");
   fail = read_standard_start_system();
   fail = define_output_file();
   printf("\nSee the output file results ...\n\n");
   fail = copy_start_system_to_container();
   fail = copy_start_solutions_to_container();
   fail = validate_solutions();
}
Пример #3
0
void test_deflate ( void )
{
   int fail,dim,len;

   printf("\nRunning deflation ...\n");
   fail = read_standard_start_system();
   fail = copy_start_system_to_container();
   fail = copy_start_solutions_to_container();
   fail = syscon_number_of_polynomials(&dim);
   printf("The system container has %d polynomials.\n",dim);
   fail = solcon_number_of_solutions(&len);
   printf("The solution container has size %d.\n",len);
   fail = standard_deflate();
   printf("The solutions after deflation :\n");
   fail = solcon_write_solutions();
}
Пример #4
0
int call_initialize_standard_homotopy ( int *index )
{
   int fail,len,fixed;

   fail = read_target_system_without_solutions();
   fail = read_standard_start_system();
   fail = copy_start_solutions_to_container();
   fail = solcon_number_of_standard_solutions(&len);
   printf("Number of start solutions : %d\n",len);
   printf("-> give index of solution : "); scanf("%d",index);
   printf("Fixed gamma constant ? (1 = yes/0 = no) "); scanf("%d",&fixed);
   fail = initialize_standard_homotopy(fixed);
   fail = initialize_standard_solution(*index);

   return fail;
}
Пример #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;
}