Пример #1
0
static void
write_file( char *target, int rank, MPI_Info *info ) {
    MPI_File wfh;
    MPI_Status mpi_stat;
    int mpi_ret;
    int i;
    char buffer[OBJ_SIZE];

    if ( debug ) printf( "%d writing file %s\n", rank, target );
    
    if( (mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, 
                    MPI_MODE_WRONLY | MPI_MODE_CREATE, *info, &wfh ) )
                != MPI_SUCCESS ) 
    {
        fatal_error( mpi_ret, NULL, "open for write" );
    }

    for( i = 0; i < NUM_OBJS; i++ ) {
        MPI_Offset offset = get_offset( rank, NUM_OBJS, OBJ_SIZE, i );
        fill_buffer( buffer, OBJ_SIZE, rank, offset );
        if ( debug ) printf( "%s", buffer );
        if ( (mpi_ret = MPI_File_write_at_all( wfh, offset, buffer, OBJ_SIZE,
                        MPI_CHAR, &mpi_stat ) ) != MPI_SUCCESS ) 
        {
            fatal_error( mpi_ret, &mpi_stat, "write" );
        }
    }

    if ( debug ) print_hints( rank, &wfh );

    if( (mpi_ret = MPI_File_close( &wfh ) ) != MPI_SUCCESS ) {
        fatal_error( mpi_ret, NULL, "close for write" );
    }
    if ( debug ) printf( "%d wrote file %s\n", rank, target );
}
Пример #2
0
/**
 * Print out the setting information for the application run.
 *
 * @param test_params_p Pointer to test_params. 
 * @param numprocs      Number of processes used. 
 * @return              0 on success.
 */
static void print_settings(struct test_params_s *test_params_p, int numprocs) 
{
    int result_size_max = 0, result_data_max = 0;
    if (test_params_p->query_size_max > 
	test_params_p->database_sequence_size_max)
	result_size_max = test_params_p->query_size_max;
    else
	result_size_max = test_params_p->database_sequence_size_max;
    
    result_data_max = (3*result_size_max)*test_params_p->result_count_max;
    fprintf(
	stdout,
	"#################### Experimental Settings #################\n"
	"numprocs                                = %d\n"
	"total_frags                             = %d\n"
	"query_count                             = %d\n",
	numprocs,
	test_params_p->total_frags,
	test_params_p->query_count);
    if (test_params_p->query_params_file == NULL)
    	fprintf(
	    stdout,
	    "query_size_min                          = %d\n"
	    "query_size_max                          = %d\n",
	    test_params_p->query_size_min,
	    test_params_p->query_size_max);
    if (test_params_p->db_params_file == NULL)
    	fprintf(
	    stdout,
	    "database_sequence_size_min              = %d\n"
	    "database_sequence_size_max              = %d\n",
	    test_params_p->database_sequence_size_min,
	    test_params_p->database_sequence_size_max);
    if (test_params_p->query_params_file != NULL)
        fprintf(
	    stdout,
	    "query_params_file                       = %s\n",
	    test_params_p->query_params_file);
    if (test_params_p->db_params_file != NULL)
    	fprintf(
	    stdout,
	    "db_params_file                          = %s\n",
	    test_params_p->db_params_file);
    fprintf(
	stdout,
	"result_size_min                         = %d\n"
	"result_count_min                        = %d\n"
	"result_count_max                        = %d\n"
	"compute_speed                           = %f\n"
	"io_method                               = %s\n"
	"parallel_io                             = %d\n"
	"query_sync                              = %d\n"
	"output_file                             = %s\n"
	"atomicity                               = %d\n"
	"end_write                               = %d\n",
	test_params_p->result_size_min,
	test_params_p->result_count_min,
	test_params_p->result_count_max,
	test_params_p->compute_speed,
	io_method_name[test_params_p->io_method],
	test_params_p->parallel_io,
	test_params_p->query_sync,
	test_params_p->output_file,
	test_params_p->atomicity,
	test_params_p->end_write);
    if (test_params_p->query_params_file == NULL &&
	test_params_p->db_params_file == NULL)
	fprintf(
	    stdout,
	    "maximum data / query                    = %d\n",
	    result_data_max);
    print_hints(test_params_p);
    fprintf(
	stdout,
	"############################################################\n\n");
}
Пример #3
0
std::ostream& operator << (std::ostream& out, const Level& l)
{
    Date best_built = l.built;
    // This is the date of the infinity change, see above in the load function.
    if (l.built < Date("2011-01-08 00:00:00")) best_built = Date("");

    out
     << IO::LineDollar(gloB->level_built,            best_built        )
//   players_intended shouldn't be yet written, game doesn't admit to set it
//   << IO::LineHash  (gloB->level_players_intended, l.players_intended)
     << IO::LineDollar(gloB->level_author,           l.author          )
     << IO::LineDollar(gloB->level_name_german,      l.name_german     )
     << IO::LineDollar(gloB->level_name_english,     l.name_english    )

     << std::endl;

    print_hints(out, l.hints_german,  gloB->level_tutorial_german,
                                      gloB->level_hint_german);
    print_hints(out, l.hints_english, gloB->level_tutorial_english,
                                      gloB->level_hint_english);
    if (! l.hints_german.empty() || ! l.hints_english.empty()) out
     << std::endl;

    out
     << IO::LineHash  (gloB->level_size_x,       l.size_x  )
     << IO::LineHash  (gloB->level_size_y,       l.size_y  )
     << IO::LineHash  (gloB->level_torus_x,      l.torus_x )
     << IO::LineHash  (gloB->level_torus_y,      l.torus_y );

    if (l.start_manual) out
     << IO::LineHash  (gloB->level_start_x,      l.start_x )
     << IO::LineHash  (gloB->level_start_y,      l.start_y );

    out
     << IO::LineHash  (gloB->level_bg_red,       l.bg_red  )
     << IO::LineHash  (gloB->level_bg_green,     l.bg_green)
     << IO::LineHash  (gloB->level_bg_blue,      l.bg_blue )

     << std::endl

     << IO::LineHash  (gloB->level_seconds,       l.seconds )
     << IO::LineHash  (gloB->level_initial,       l.initial )
     << IO::LineHash  (gloB->level_required,      l.required)
     << IO::LineHash  (gloB->level_spawnint_slow, l.spawnint_slow)
     << IO::LineHash  (gloB->level_spawnint_fast, l.spawnint_fast)

//   << std::endl
//   << IO::LineHash(gloB->level_count_neutrals_only, l.count_neutrals_only)
//   << IO::LineHash(gloB->level_transfer_skills,     l.transfer_skills)

     << std::endl;

    for (Level::CSkIt itr = l.skills.begin(); itr != l.skills.end(); ++itr) {
        if (itr->first == LixEn::NOTHING || itr->second == 0)
            continue;
        out << IO::LineHash(LixEn::ac_to_string(itr->first), itr->second);
    }

    // Erst Spezialobjekte, dann Terrain
    for (int type = Object::TERRAIN; type != Object::MAX; ++type) {
        if (type != Object::TERRAIN) out << l.pos[type];
    }
    out << l.pos[Object::TERRAIN];
    return out;
}