Commit 7093c844 authored by Francesco Tomba's avatar Francesco Tomba
Browse files

io-handling maybe fixed, to check

parent 9d256282
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -168,8 +168,8 @@ typedef struct global_context_t
    idx_t* rank_n_points;                             //processor name
    heap_node* __local_heap_buffers;                //buffer that stores nearest neighbors
	MPI_Comm mpi_communicator;                      //mpi communicator
    char input_data_file[DEFAULT_STR_LEN];
    int input_data_in_float32;
    char input_data_file[DEFAULT_STR_LEN];
    char output_assignment_file[DEFAULT_STR_LEN];
    char output_data_file[DEFAULT_STR_LEN];
} global_context_t;
+18 −36
Original line number Diff line number Diff line
@@ -294,30 +294,11 @@ void compute_bounding_box_pointset(global_context_t *ctx, pointset_t *ps) {
        }
    }

    /* Reduce to obtain bb */
    /*
    MPI_Allreduce(  const void *sendbuf,
                                  void *recvbuf,
                                  int count,
                                  MPI_Datatype datatype,
                                  MPI_Op op,
                                  MPI_Comm comm)
    */

    /*get the bounding box */

    MPI_Allreduce(MPI_IN_PLACE, lb, ps->dims, MPI_MY_FLOAT, MPI_MIN, ctx->mpi_communicator);
    MPI_Allreduce(MPI_IN_PLACE, ub, ps->dims, MPI_MY_FLOAT, MPI_MAX, ctx->mpi_communicator);

    /*
    DB_PRINT("[RANK %d]:", ctx -> mpi_rank);
    for(size_t d = 0; d < ctx -> dims; ++d)
    {
          DB_PRINT("%lf ", ctx -> ub_box[d]);
    }
    DB_PRINT("\n");
    */

    /*
    MPI_DB_PRINT("[PS BOUNDING BOX]: ");
    for(size_t d = 0; d < ps -> dims; ++d) MPI_DB_PRINT("d%d:[%lf, %lf] ",(int)d,
@@ -380,8 +361,6 @@ guess_t retrieve_guess_pure(global_context_t *ctx, pointset_t *ps,
    MPI_DB_PRINT("[MASTER] best guess @ %lf is %lf on bin %d on dimension %d --- x0 %lf x1 %lf y0 %lf y1 %lf\n",pc, x_guess,idx, d, x0, x1, y0, y1);
    */



    guess_t g = {.bin_idx = idx, .x_guess = x_guess};
    return g;
}
@@ -751,6 +730,10 @@ void tree_print_leaves(global_context_t* ctx, top_kdtree_node_t* root)

void build_top_kdtree(global_context_t *ctx, pointset_t *og_pointset, top_kdtree_t *tree, int n_bins, float_t tolerance) 
{
    // TODO: 

    // NOTE: For the me of the future
    // pointsests are only "helper structs" partitions 
    size_t tot_n_points = 0;
    MPI_Allreduce(&(og_pointset->n_points), &tot_n_points, 1, MPI_UINT64_T, MPI_SUM, ctx->mpi_communicator);

@@ -777,8 +760,7 @@ void build_top_kdtree(global_context_t *ctx, pointset_t *og_pointset, top_kdtree
                                       .n_points   = og_pointset->n_points,
                                       .n_procs    = ctx->world_size,
                                       .parent     = NULL,
                                       .lr         = NO_CHILD 
                                    };
                                       .lr         = NO_CHILD };

    enqueue_partition(&queue, current_partition);
    pointset_t current_pointset;
@@ -801,14 +783,14 @@ void build_top_kdtree(global_context_t *ctx, pointset_t *og_pointset, top_kdtree
        /* insert node */
        
        // MPI_DB_PRINT(   "[RANK %d] Handling partition:\n"\
        //                 "\tcurrent_node %p,\n"\
        //                 "\tdim %d,\n"\
        //                 "\tn_points %lu,\n"\
        //                 "\tstart_proc %d,\n"\
        //                 "\tn_procs %d\n"\
        //                 "\tparent %p\n"\
        //                 "\tbase_ptr %p\n"\
        //                 "\tlr %d\n", 
        //                 "    current_node %p,\n"\
        //                 "    dim %d,\n"\
        //                 "    n_points %lu,\n"\
        //                 "    start_proc %d,\n"\
        //                 "    n_procs %d\n"\
        //                 "    parent %p\n"\
        //                 "    base_ptr %p\n"\
        //                 "    lr %d\n", 
        //         ctx -> mpi_rank,
        //         current_node,
        //         current_partition.d,