Commit f9ee1142 authored by Shane Snyder's avatar Shane Snyder

Updated replay tool buffer allocation

parent 0d4cd618
......@@ -194,6 +194,8 @@ int load_workload(char *conf_path, int rank)
}
char* buf = NULL;
int fd = -1;
int op_num = 0;
int main(int argc, char *argv[])
{
......@@ -257,13 +259,6 @@ int main(int argc, char *argv[])
goto error_exit;
}
buf = malloc(16*1024*1024);
assert(buf);
for(i=0; i<16*1024*1024; i++)
{
buf[i] = '1';
}
/* synchronize before replay */
MPI_Barrier(MPI_COMM_WORLD);
......@@ -325,6 +320,7 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
struct file_info *tmp_list = NULL;
struct qlist_head *hash_link = NULL;
int ret;
int i;
#if DEBUG_PROFILING
double start, end;
......@@ -417,6 +413,16 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
tmp_list->file_descriptor = fildes;
qhash_add(fd_table, &(replay_op.u.open.file_id), &(tmp_list->hash_link));
if (!buf)
{
buf = malloc(16*1024*1024);
assert(buf);
for(i=0; i<16*1024*1024; i++)
{
buf[i] = '1';
}
}
#if DEBUG_PROFILING
end = MPI_Wtime();
total_open_time += (end - start);
......@@ -467,19 +473,8 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
tmp_list = qhash_entry(hash_link, struct file_info, hash_link);
fildes = tmp_list->file_descriptor;
#if 0
/* perform the write operation */
buf = malloc(replay_op.u.write.size);
if (!buf)
{
fprintf(stderr, "No memory available for write buffer\n");
return -1;
}
#endif
ret = pwrite(fildes, buf, replay_op.u.write.size, replay_op.u.write.offset);
#if 0
free(buf);
#endif
if (ret < 0)
{
fprintf(stderr, "Rank %d failure on operation %lld [WRITE: %s]\n",
......@@ -507,19 +502,8 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
tmp_list = qhash_entry(hash_link, struct file_info, hash_link);
fildes = tmp_list->file_descriptor;
#if 0
/* perform the write operation */
buf = malloc(replay_op.u.read.size);
if (!buf)
{
fprintf(stderr, "No memory available for write buffer\n");
return -1;
}
#endif
ret = pread(fildes, buf, replay_op.u.read.size, replay_op.u.read.offset);
#if 0
free(buf);
#endif
if (ret < 0)
{
fprintf(stderr, "Rank %d failure on operation %lld [READ: %s]\n",
......
Markdown is supported
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