bool_t check_inx_append_mthread(MAGMA_INDEX inx_type, stringer_t *errmsg) { void *result; inx_t *inx = NULL; bool_t outcome = true; pthread_t *threads = NULL; if (status() && (!(inx = inx_alloc(inx_type | M_INX_LOCK_MANUAL, &ns_free)))) { st_sprint(errmsg, "An error occured during initial allocation in the inx check append multi-threaded test."); outcome = false; } else { if (!INX_CHECK_MTHREADS || !(threads = mm_alloc(sizeof(pthread_t) * INX_CHECK_MTHREADS))) { outcome = false; } else { for (uint64_t counter = 0; counter < INX_CHECK_MTHREADS; counter++) { if (thread_launch(threads + counter, &check_inx_append_mthread_test, inx)) { st_sprint(errmsg, "An error occured when launching a thread."); outcome = false; } } for (uint64_t counter = 0; counter < INX_CHECK_MTHREADS; counter++) { if (thread_result(*(threads + counter), &result) || !result || !*(bool_t *)result) { if (st_empty(errmsg)) st_sprint(errmsg, "One of the append check threads returned false."); outcome = false; } mm_cleanup(result); } mm_free(threads); } if (inx_count(inx) != 0 && st_empty(errmsg)) { st_sprint(errmsg, "The index was not properly cleared."); outcome = false; } } if (inx) { inx_cleanup(inx); } return outcome; }
/* This function determines which input file type is being used, * and calls the appropriate read function. If a new type of input * file is added to the driver, then a section needs to be added for * it here. *---------------------------------------------------------------------------*/ static int read_mesh( int Proc, int Num_Proc, PROB_INFO_PTR prob, PARIO_INFO_PTR pio_info, MESH_INFO_PTR mesh) { #ifdef DEBUG_READ_MESH int i, tpins, the, tverts, pins, he, verts; #endif /* local declarations */ /*-----------------------------Execution Begins------------------------------*/ if (pio_info->file_type == CHACO_FILE) { if (!read_chaco_file(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from read_chaco_mesh\n"); return 0; } } else if (pio_info->file_type == NEMESIS_FILE) { if (!read_exoII_file(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from read_exoII_mesh\n"); return 0; } } else if (pio_info->file_type == HYPERGRAPH_FILE) { if (!read_hypergraph_file(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from read_hypergraph_file\n"); return 0; } } else if (pio_info->file_type == MATRIXMARKET_FILE) { if (!read_mm_file(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from read_mm_file\n"); return 0; } mm_cleanup(mesh); } else if (pio_info->file_type == MATRIXMARKET_PLUS_FILE) { if (!read_mtxplus_file(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from read_mtxplus_file\n"); return 0; } /* KDDKDD 3/26/10: * Eventually, we should do cleanup here to address bug 3346. * but doing so will change the answer files. * mm_cleanup(mesh); */ } else if (pio_info->file_type == NO_FILE_POINTS) { if (!create_random_input(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from create_random_input\n"); return 0; } } else if (pio_info->file_type == NO_FILE_TRIANGLES) { if (!create_random_triangles(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from create_random_triangles\n"); return 0; } } else if (pio_info->file_type == NO_FILE_GRAPH) { if (!create_a_graph(Proc, Num_Proc, prob, pio_info, mesh)) { Gen_Error(0, "fatal: Error returned from create_a_graph\n"); return 0; } } else { Gen_Error(0, "fatal: Invalid file type.\n"); return 0; } #ifdef DEBUG_READ_MESH for (i=0; i<Num_Proc; i++){ if (i == Proc){ printf("Process %d:\n",i); print_mesh(Proc, mesh, &pins, &he, &verts); } MPI_Barrier(MPI_COMM_WORLD); } MPI_Reduce(&pins, &tpins, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce(&he, &the, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce(&verts, &tverts, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); if (Proc == 0){ if (mesh->format == ZOLTAN_COMPRESSED_EDGE){ printf("Total pins %d, total vertices %d, total rows %d\n", tpins, tverts, the); } else{ printf("Total pins %d, total vertices %d, total columns %d\n", tpins, tverts, the); } } #endif return 1; }