Commit 49b735c2 authored by Thomas Steinreiter's avatar Thomas Steinreiter
Browse files

Merge branch 'wireworld' of gitlab.com:steinret/CodeVault into wireworld

parents 675569f0 79c7424d
......@@ -67,7 +67,7 @@ Follow the compilation instructions given in the main directory of the kernel sa
Assuming that the input file `primes.wi` is in your current working directory, to run the program you may use something similar to
```
mpirun -n [nprocs] ./5_structured_wireworld_c primes
mpirun -n [nprocs] ./5_structured_wireworld_c primes.wi
```
either on the command line or in your batch script. Note that only the input file's basename (omitting the file extension) is passed to the program.
......@@ -93,7 +93,7 @@ For large numbers as arguments to the option `-g`, the suffixes 'k' or 'M' may b
If you run
```
mpirun -n 12 ./5_structured_wireworld_c -i 10 -g 50k -v 2 --nprocs-x 3 primes
mpirun -n 12 ./5_structured_wireworld_c -i 10 -g 50k -v 2 --nprocs-x 3 primes.wi
```
the output should look similar to
......
......@@ -2,6 +2,7 @@
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "configuration.h"
......@@ -28,6 +29,8 @@ long parse_long(const char *str);
int log_enabled(const conf_t *c, int lvl);
void chop_wi_extension(char *filename);
// ==========================================================================
void conf_init_default(conf_t *c)
......@@ -102,6 +105,7 @@ void conf_init_from_args(conf_t *c, int argc, char* argv[])
}
strncpy(c->file_basename, argv[optind], sizeof(c->file_basename));
chop_wi_extension(c->file_basename);
conf_set_or_validate_nprocs(c);
}
......@@ -179,3 +183,18 @@ long parse_long(const char *str)
return result;
}
void chop_wi_extension(char *filename)
{
char *extension = strrchr(filename, '.');
if(extension != NULL) {
if(strcmp(extension, FILE_EXT) == 0) {
*extension = '\0';
} else {
fprintf(stderr,
"Input file '%s' does not have expected file extension '%s'.\n",
filename, FILE_EXT
);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
}
}
......@@ -67,7 +67,6 @@ void broadcast_configuration(conf_t *c) {
void read_input(const conf_t *c, world_t *world) {
int rank;
MPI_Comm cart_comm;
char input_filename[FILE_NAME_SZ];
MPI_File file;
......
......@@ -200,7 +200,7 @@ void do_simulation_persistent_request_no_overlap(world_t *world, size_t n_genera
const size_t n_neighbors = world->transfer.n_neighbors;
const size_t sz = world_get_storage_size(world);
size_t g, i;
size_t g;
MPI_Request *requests = world->transfer.persistent_requests;
for(g = 0; g < n_generations; g++) {
......@@ -225,7 +225,7 @@ void do_simulation_persistent_request_overlap(world_t *world, size_t n_generatio
const size_t n_neighbors = world->transfer.n_neighbors;
const size_t sz = world_get_storage_size(world);
size_t g, i;
size_t g;
MPI_Request *requests = world->transfer.persistent_requests;
for(g = 0; g < n_generations; g++) {
......
#include <string.h>
#include <stdlib.h>
#include "world.h"
......@@ -44,7 +45,6 @@ void world_init(world_t *world, size_t *global_size, const conf_t *c)
{
int dim, lo, hi;
int nprocs[2], periods[2], proc_coord[2];
char *buffer;
size_t storage_size;
MPI_Comm cart_comm;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment