Commit ed06b81f authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

replaced all xmalloc with malloc for tests

parent 2da6059b
......@@ -111,7 +111,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
if (rank == 0 && setup.compute_checksum)
{
var = (double *)xmalloc((size_t)nlon * (size_t)nlat
var = (double *)malloc((size_t)nlon * (size_t)nlat
* (size_t)setup.max_nlev * sizeof(var[0]));
}
......@@ -129,7 +129,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
rank_coord[0] = rank % npart[0],
rank_coord[1] = rank / npart[0];
}
blk_displ = xmalloc((size_t)setup.max_nlev * sizeof (blk_displ[0]) * 2);
blk_displ = malloc((size_t)setup.max_nlev * sizeof (blk_displ[0]) * 2);
blk_lens = blk_displ + setup.max_nlev;
#endif
......@@ -138,10 +138,10 @@ modelRun(struct model_config setup, MPI_Comm comm)
gridID = gridCreate ( GRID_LONLAT, nlon*nlat );
gridDefXsize ( gridID, nlon );
gridDefYsize ( gridID, nlat );
lons = (double *)xmalloc((size_t)nlon * sizeof (lons[0]));
lons = (double *)malloc((size_t)nlon * sizeof (lons[0]));
for (i = 0; i < nlon; ++i)
lons[i] = ((double)(i * 360))/nlon;
lats = (double *)xmalloc((size_t)nlat * sizeof (lats[0]));
lats = (double *)malloc((size_t)nlat * sizeof (lats[0]));
for (i = 0; i < nlat; ++i)
lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons );
......@@ -155,7 +155,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
#endif
gridDefUUID(gridID, uuid);
}
levs = (double *)xmalloc((size_t)setup.max_nlev * sizeof (levs[0]));
levs = (double *)malloc((size_t)setup.max_nlev * sizeof (levs[0]));
{
double lscale = 1.0/(double)(setup.max_nlev - 1);
for (i = 0; i < setup.max_nlev; ++i)
......@@ -163,7 +163,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
}
vlistID = vlistCreate ();
varDesc = (struct varDesc_t *)xmalloc((size_t)nVars * sizeof (varDesc[0]));
varDesc = (struct varDesc_t *)malloc((size_t)nVars * sizeof (varDesc[0]));
for (int varIdx = 0; varIdx < nVars; varIdx++ )
{
int varLevs = (int)random()%4;
......@@ -252,7 +252,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
Xt_xmap xmap4gather
= xt_xmap_all2all_new(part_idxlist, gather_idxlist, comm);
xt_idxlist_delete(gather_idxlist);
struct Xt_offset_ext *src_blocks = xmalloc((size_t)varLevs
struct Xt_offset_ext *src_blocks = malloc((size_t)varLevs
* sizeof (*src_blocks));
struct Xt_offset_ext dst_block = { .start = 0,
.size = nlon * nlat * varLevs,
......
......@@ -94,9 +94,9 @@ modelRun(struct model_config setup, MPI_Comm comm)
xmpi ( MPI_Comm_size ( comm, &comm_size ));
if (rank == 0 && setup.compute_checksum)
{
chunks = xmalloc((size_t)comm_size * sizeof (chunks[0]));
displs = xmalloc((size_t)comm_size * sizeof (displs[0]));
var = xmalloc((size_t)nlon * (size_t)nlat
chunks = malloc((size_t)comm_size * sizeof (chunks[0]));
displs = malloc((size_t)comm_size * sizeof (displs[0]));
var = malloc((size_t)nlon * (size_t)nlat
* (size_t)setup.max_nlev * sizeof(var[0]));
}
#endif
......@@ -106,10 +106,10 @@ modelRun(struct model_config setup, MPI_Comm comm)
gridID = gridCreate ( GRID_LONLAT, nlon*nlat );
gridDefXsize ( gridID, nlon );
gridDefYsize ( gridID, nlat );
lons = (double *)xmalloc((size_t)nlon * sizeof (lons[0]));
lons = (double *)malloc((size_t)nlon * sizeof (lons[0]));
for (i = 0; i < nlon; ++i)
lons[i] = ((double)(i * 360))/nlon;
lats = (double *)xmalloc((size_t)nlat * sizeof (lats[0]));
lats = (double *)malloc((size_t)nlat * sizeof (lats[0]));
for (i = 0; i < nlat; ++i)
lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons );
......@@ -123,7 +123,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
#endif
gridDefUUID(gridID, uuid);
}
levs = (double *)xmalloc((size_t)setup.max_nlev * sizeof (levs[0]));
levs = (double *)malloc((size_t)setup.max_nlev * sizeof (levs[0]));
{
double lscale = 1.0/(double)(setup.max_nlev - 1);
for (i = 0; i < setup.max_nlev; ++i)
......@@ -131,7 +131,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
}
vlistID = vlistCreate ();
varDesc = (struct varDesc_t *)xmalloc((size_t)nVars * sizeof (varDesc[0]));
varDesc = (struct varDesc_t *)malloc((size_t)nVars * sizeof (varDesc[0]));
for (int varIdx = 0; varIdx < nVars; varIdx++ )
{
int varLevs = (int)random()%4;
......
......@@ -50,7 +50,7 @@ cksum_stream(const char *fname, size_t *table_len)
break;
}
checksum_state = (uint32_t *)xcalloc((size_t)nvars, sizeof (checksum_state[0]));
varSize = (struct var_size_t *)xmalloc((size_t)nvars * sizeof (varSize[0]));
varSize = (struct var_size_t *)malloc((size_t)nvars * sizeof (varSize[0]));
for (i = 0; i < nvars; ++i)
{
......@@ -121,7 +121,7 @@ cksum_stream(const char *fname, size_t *table_len)
++tsID;
}
file_vars = (struct cksum_table *)xmalloc((size_t)nvars * sizeof (file_vars[0]));
file_vars = (struct cksum_table *)malloc((size_t)nvars * sizeof (file_vars[0]));
for (i = 0; i < nvars; ++i)
{
file_vars[i].code = vlistInqVarCode(vlistID, i);
......
......@@ -30,7 +30,7 @@ int main()
size_t datasize = (size_t)nlon * (size_t)nlat;
data = (double *)xmalloc(datasize * sizeof (double));
data = (double *)malloc(datasize * sizeof (double));
memset(data, 0, datasize * sizeof (double));
gridID = gridCreate(GRID_GAUSSIAN, (int)datasize);
......
......@@ -222,7 +222,7 @@ int modelRun(MPI_Comm comm)
}
reshPackBufferCreate ( &sendBuffer, &bufferSize, &comm );
recvBuffer = (char *)xmalloc((size_t)bufferSize);
recvBuffer = (char *)malloc((size_t)bufferSize);
#ifdef MPI_MARSHALLING
xmpi(MPI_Sendrecv(sendBuffer, bufferSize, MPI_PACKED, 0, 0,
recvBuffer, bufferSize, MPI_PACKED, 0, 0,
......
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