Commit 2c9d5ea4 authored by Moritz Hanke's avatar Moritz Hanke Committed by Thomas Jahns
Browse files

replaces usage of unsigned's with int's and size_t's

parent 1bbcaacb
......@@ -733,18 +733,18 @@ idxsection_get_index_stripes(Xt_idxlist idxlist, struct Xt_stripe **stripes,
* section->dims[section->ndim-1].local_size);
p[i].stride = 1;
for (unsigned j = 0; j < (unsigned)section->ndim - 1; ++j)
for (int j = 0; j < section->ndim - 1; ++j)
p[i].start = (Xt_int)(p[i].start
+ curr_local_position[j]
* section->dims[j].global_stride);
for (unsigned j = (unsigned)section->ndim - 2; j < (unsigned)section->ndim; --j)
if (curr_local_position[j] < isign(section->dims[j].local_size) *
section->dims[j].local_size - 1) {
curr_local_position[j]++;
break;
} else
curr_local_position[j] = 0;
for (int j = section->ndim - 2; j >= 0; --j)
if (curr_local_position[j] < isign(section->dims[j].local_size) *
section->dims[j].local_size - 1) {
curr_local_position[j]++;
break;
} else
curr_local_position[j] = 0;
}
*stripes = p;
*num_stripes = (int)nstripes;
......
......@@ -285,7 +285,7 @@ MPI_Datatype xt_mpi_generate_datatype(int const * displacements, int count,
int offset = 0;
for (unsigned i = 0; i < (unsigned)new_count; ++i) {
for (int i = 0; i < new_count; ++i) {
tmp_displ[i] = displacements[offset];
offset += blocklengths[i];
......
......@@ -139,7 +139,7 @@ static void exchange_idxlists(struct Xt_com_list **src_intersections,
position = 0;
size_t dst_isect_count = 0, src_isect_count = 0;
// compute intersections
for (unsigned i = 0; i < (unsigned)comm_size; ++i) {
for (int i = 0; i < comm_size; ++i) {
// unpack buffers
Xt_idxlist src = xt_idxlist_unpack(recv_buffer, recv_buffer_size,
......@@ -150,7 +150,7 @@ static void exchange_idxlists(struct Xt_com_list **src_intersections,
if (xt_idxlist_get_num_indices(intersect) > 0) {
dsti[dst_isect_count].list = intersect;
dsti[dst_isect_count].rank = (int)i;
dsti[dst_isect_count].rank = i;
++dst_isect_count;
}
else
......@@ -160,7 +160,7 @@ static void exchange_idxlists(struct Xt_com_list **src_intersections,
if (xt_idxlist_get_num_indices(intersect) > 0) {
srci[src_isect_count].list = intersect;
srci[src_isect_count].rank = (int)i;
srci[src_isect_count].rank = i;
++src_isect_count;
}
else
......
......@@ -80,7 +80,7 @@ struct dist_dir_entry {
};
struct dist_dir {
unsigned num_entries;
int num_entries;
struct dist_dir_entry entries[];
};
......@@ -371,7 +371,7 @@ recv_and_unpack_intersection(struct dist_dir *dist_dir, int recv_size,
if (total_recv_size != recv_size)
Xt_abort(comm, "ERROR: recv_intersections received wrong number of bytes",
__FILE__, __LINE__);
dist_dir->num_entries = (unsigned)recv_count;
dist_dir->num_entries = recv_count;
}
static void
......@@ -407,7 +407,7 @@ recv_and_unpack_intersections(int recv_size[SEND_SIZE_ASIZE],
struct isect
{
int rank;
unsigned dst_list, src_list;
int dst_list, src_list;
Xt_idxlist idxlist;
};
......@@ -418,12 +418,13 @@ match_src_dst_dist_dirs(struct dist_dir * src_dist_dir,
{
struct isect (*src_dst_intersections_)
= (*src_dst_intersections)
= xmalloc(src_dist_dir->num_entries * dst_dist_dir->num_entries
= xmalloc((size_t)src_dist_dir->num_entries
* (size_t)dst_dist_dir->num_entries
* sizeof(**src_dst_intersections));
size_t isect_fill = 0;
for (unsigned i = 0; i < src_dist_dir->num_entries; ++i)
for (unsigned j = 0; j < dst_dist_dir->num_entries; ++j)
for (int i = 0; i < src_dist_dir->num_entries; ++i)
for (int j = 0; j < dst_dist_dir->num_entries; ++j)
{
Xt_idxlist intersection = xt_idxlist_get_intersection(
src_dist_dir->entries[i].idxlist, dst_dist_dir->entries[j].idxlist);
......@@ -483,8 +484,8 @@ match_and_pack_src_dst_dist_dirs(struct dist_dir * src_dist_dir,
int msg_size = rank_pack_size
+ (int)xt_idxlist_get_pack_size(src_dst_intersections[i].idxlist,
comm);
unsigned src = src_dst_intersections[i].src_list,
dst = src_dst_intersections[i].dst_list;
int src = src_dst_intersections[i].src_list,
dst = src_dst_intersections[i].dst_list;
send_size[src_dist_dir->entries[src].rank][SEND_SIZE_SRC] += msg_size;
++(send_size[src_dist_dir->entries[src].rank][SEND_NUM_SRC]);
send_size[dst_dist_dir->entries[dst].rank][SEND_SIZE_DST] += msg_size;
......@@ -503,7 +504,7 @@ match_and_pack_src_dst_dist_dirs(struct dist_dir * src_dist_dir,
for (size_t i = 0; i < num_intersections; ++i)
{
unsigned dst = src_dst_intersections[i].dst_list;
int dst = src_dst_intersections[i].dst_list;
int dst_rank = dst_dist_dir->entries[dst].rank;
// pack rank
xt_mpi_call(MPI_Pack(&dst_rank, 1, MPI_INT,
......@@ -523,7 +524,7 @@ match_and_pack_src_dst_dist_dirs(struct dist_dir * src_dist_dir,
for (size_t i = 0; i < num_intersections; ++i)
{
unsigned src = src_dst_intersections[i].src_list;
int src = src_dst_intersections[i].src_list;
int src_rank = src_dist_dir->entries[src].rank;
// pack rank
......@@ -591,7 +592,7 @@ recv_and_unpack_dist_dir_result(struct dist_dir * dist_dir, int recv_size,
{
// initiate distributed directories
unsigned num_entries = 0;
int num_entries = 0;
while (recv_size > 0) {
MPI_Status status;
......@@ -650,13 +651,13 @@ generate_intersection_from_dist_dir_results(struct dist_dir *dist_dir_results,
size_t intersections_array_size = 0;
struct Xt_com_list *p
= xmalloc(dist_dir_results->num_entries * sizeof(*p));
= xmalloc((size_t)dist_dir_results->num_entries * sizeof(*p));
size_t num_src_ix = 0;
for (int i = 0; i < comm_size; ++i) {
int num_intersections_per_rank = 0;
for (unsigned j = 0; j < dist_dir_results->num_entries; ++j)
for (int j = 0; j < dist_dir_results->num_entries; ++j)
num_intersections_per_rank += (dist_dir_results->entries[j].rank == i);
if (num_intersections_per_rank > 0) {
......@@ -698,9 +699,7 @@ generate_intersection_from_dist_dir_results(struct dist_dir *dist_dir_results,
static void free_dist_dir(struct dist_dir * dist_dir) {
unsigned i;
for (i = 0; i < dist_dir->num_entries; ++i)
for (int i = 0; i < dist_dir->num_entries; ++i)
xt_idxlist_delete(dist_dir->entries[i].idxlist);
free(dist_dir);
}
......@@ -733,13 +732,13 @@ static void recv_and_unpack_dist_dir_results(int recv_size[SEND_SIZE_ASIZE],
recv_size[SEND_SIZE_SRC],
recv_buffer, src_recv_tag, comm);
assert(src_dist_dir_results->num_entries
== (unsigned)recv_size[SEND_NUM_SRC]);
== recv_size[SEND_NUM_SRC]);
recv_and_unpack_dist_dir_result(dst_dist_dir_results,
recv_size[SEND_SIZE_DST],
recv_buffer, dst_recv_tag, comm);
assert(dst_dist_dir_results->num_entries
== (unsigned)recv_size[SEND_NUM_DST]);
== recv_size[SEND_NUM_DST]);
free(recv_buffer);
......
......@@ -595,10 +595,10 @@ static void xmap_intersection_delete(Xt_xmap xmap) {
Xt_xmap_intersection xmap_intersection = xmi(xmap);
for (unsigned i = 0; i < (unsigned)xmap_intersection->n_in; ++i)
for (int i = 0; i < xmap_intersection->n_in; ++i)
free(xmap_intersection->in_msg[i].transfer_pos);
for (unsigned i = 0; i < (unsigned)xmap_intersection->n_out; ++i)
for (int i = 0; i < xmap_intersection->n_out; ++i)
free(xmap_intersection->out_msg[i].transfer_pos);
free(xmap_intersection->in_msg);
......
......@@ -100,7 +100,7 @@ int main(void) {
double ref_dst_data[] = {1,3,5};
unsigned i;
size_t i;
for (i = 0; i < sizeof(dst_data) / sizeof(dst_data[0]); ++i)
if (ref_dst_data[i] != dst_data[i])
......@@ -171,7 +171,7 @@ int main(void) {
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -259,7 +259,7 @@ test_repeated_redist(int cache_size)
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -280,7 +280,7 @@ test_repeated_redist(int cache_size)
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -301,7 +301,7 @@ test_repeated_redist(int cache_size)
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......
......@@ -108,7 +108,7 @@ int main(void) {
double ref_dst_data[] = {1,3,5};
unsigned i;
size_t i;
for (i = 0; i < sizeof(dst_data) / sizeof(dst_data[0]); ++i)
if (ref_dst_data[i] != dst_data[i])
......@@ -174,7 +174,7 @@ int main(void) {
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -190,7 +190,7 @@ int main(void) {
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......
......@@ -94,7 +94,7 @@ int main(void) {
}
{
assert(size * size * 2 * (size - 1) <= XT_INT_MAX);
assert(size * size * 2 * (size - 1) <= INT_MAX);
struct Xt_stripe stripe = {.start = (Xt_int)(rank*2*size*size),
.stride = 1, .nstrides = 2*size*size};
......@@ -102,7 +102,7 @@ int main(void) {
}
{
assert(2 * size * size * size <= XT_INT_MAX);
assert(2 * size * size * size <= INT_MAX);
struct Xt_stripe stripe = {.start = 0, .stride = 1,
.nstrides = 2*size*size*size};
......
......@@ -111,7 +111,7 @@ int main(void) {
double ref_dst_data[] = {0,2,13,9,7,0,2,0,2,13,4,6,7};
unsigned i;
size_t i;
for (i = 0; i < sizeof(dst_data) / sizeof(dst_data[0]); ++i)
if (ref_dst_data[i] != dst_data[i])
......
......@@ -122,7 +122,7 @@ int main(void) {
xt_redist_s_exchange(redist, 1, (void**)(&src_data_p),
(void**)(&dst_data_p));
//unsigned i;
//int i;
for (Xt_int i = 0; i < (Xt_int)dataSize; ++i)
if (dst_index_list[i] != dst_data[i])
......@@ -195,7 +195,7 @@ int main(void) {
xt_redist_s_exchange(redist, 1, (void**)(&src_data_p),
(void**)(&dst_data_p));
//unsigned i;
//int i;
for (i = 0; i < size; ++i)
if (dst_data[i] != i)
......
......@@ -108,7 +108,7 @@ int main(void) {
double ref_dst_data[] = {1,3,5};
unsigned i;
size_t i;
for (i = 0; i < sizeof(dst_data) / sizeof(dst_data[0]); ++i)
if (ref_dst_data[i] != dst_data[i])
......@@ -170,7 +170,7 @@ int main(void) {
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -186,7 +186,7 @@ int main(void) {
double ref_dst_data[3][3] = {{1,3,5},{6,8,10},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 3; ++j)
......@@ -247,7 +247,7 @@ int main(void) {
double ref_dst_data[5][3] = {{1,3,5},{-1,-1,-1},{6,8,10},{-1,-1,-1},{11,13,15}};
unsigned i, j;
int i, j;
for (i = 0; i < 5; ++i)
for (j = 0; j < 3; ++j)
......
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