Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Karypis committed Jul 26, 2020
2 parents e2e633a + 62d658c commit 5369458
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 22 deletions.
7 changes: 7 additions & 0 deletions BUILD-Windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ After you have found the appropriate generator, run
to generate the project files. The project files will be placed
build\windows.

Finally, you need to manually uncomment the following two lines:

//#define IDXTYPEWIDTH 32
//#define REALTYPEWIDTH 32

To compile METIS with 64 bit integers or 64 bit floats, you also need
to set IDXTYPEWIDTH or REALTYPEWIDTH to 64.

Using the CMake GUI
-------------------
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8)
project(METIS C)

set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/GKlib" CACHE PATH "path to GKlib")
set(SHARED FALSE CACHE BOOL "build a shared library")

if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion GKlib
Submodule GKlib updated 5 files
+7 −1 CMakeLists.txt
+0 −1 GKlib.h
+2 −0 gk_arch.h
+11 −0 win32/adapt.c
+14 −0 win32/adapt.h
2 changes: 1 addition & 1 deletion libmetis/balance.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void Balance2Way(ctrl_t *ctrl, graph_t *graph, real_t *ntpwgts)

if (graph->ncon == 1) {
/* return right away if the balance is OK */
if (iabs(ntpwgts[0]*graph->tvwgt[0]-graph->pwgts[0]) < 3*graph->tvwgt[0]/graph->nvtxs)
if (rabs(ntpwgts[0]*graph->tvwgt[0]-graph->pwgts[0]) < 3*graph->tvwgt[0]/graph->nvtxs)
return;

if (graph->nbnd > 0)
Expand Down
26 changes: 13 additions & 13 deletions libmetis/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,24 @@ void graph_WriteToDisk(ctrl_t *ctrl, graph_t *graph)

if (graph->free_xadj) {
if (fwrite(graph->xadj, sizeof(idx_t), nvtxs+1, fpout) != nvtxs+1)
goto ERROR;
goto error;
}
if (graph->free_vwgt) {
if (fwrite(graph->vwgt, sizeof(idx_t), nvtxs*ncon, fpout) != nvtxs*ncon)
goto ERROR;
goto error;
}
if (graph->free_adjncy) {
if (fwrite(graph->adjncy, sizeof(idx_t), xadj[nvtxs], fpout) != xadj[nvtxs])
goto ERROR;
goto error;
}
if (graph->free_adjwgt) {
if (fwrite(graph->adjwgt, sizeof(idx_t), xadj[nvtxs], fpout) != xadj[nvtxs])
goto ERROR;
goto error;
}
if (ctrl->objtype == METIS_OBJTYPE_VOL) {
if (graph->free_vsize) {
if (fwrite(graph->vsize, sizeof(idx_t), nvtxs, fpout) != nvtxs)
goto ERROR;
goto error;
}
}

Expand All @@ -344,7 +344,7 @@ void graph_WriteToDisk(ctrl_t *ctrl, graph_t *graph)
graph->ondisk = 1;
return;

ERROR:
error:
printf("Failed on writing %s\n", outfile);
fclose(fpout);
gk_rmpath(outfile);
Expand Down Expand Up @@ -375,45 +375,45 @@ void graph_ReadFromDisk(ctrl_t *ctrl, graph_t *graph)
if (graph->free_xadj) {
graph->xadj = imalloc(nvtxs+1, "graph_ReadFromDisk: xadj");
if (fread(graph->xadj, sizeof(idx_t), nvtxs+1, fpin) != nvtxs+1)
goto ERROR;
goto error;
}
xadj = graph->xadj;

if (graph->free_vwgt) {
graph->vwgt = imalloc(nvtxs*ncon, "graph_ReadFromDisk: vwgt");
if (fread(graph->vwgt, sizeof(idx_t), nvtxs*ncon, fpin) != nvtxs*ncon)
goto ERROR;
goto error;
}

if (graph->free_adjncy) {
graph->adjncy = imalloc(xadj[nvtxs], "graph_ReadFromDisk: adjncy");
if (fread(graph->adjncy, sizeof(idx_t), xadj[nvtxs], fpin) != xadj[nvtxs])
goto ERROR;
goto error;
}

if (graph->free_adjwgt) {
graph->adjwgt = imalloc(xadj[nvtxs], "graph_ReadFromDisk: adjwgt");
if (fread(graph->adjwgt, sizeof(idx_t), xadj[nvtxs], fpin) != xadj[nvtxs])
goto ERROR;
goto error;
}

if (ctrl->objtype == METIS_OBJTYPE_VOL) {
if (graph->free_vsize) {
graph->vsize = imalloc(nvtxs, "graph_ReadFromDisk: vsize");
if (fread(graph->vsize, sizeof(idx_t), nvtxs, fpin) != nvtxs)
goto ERROR;
goto error;
}
}

fclose(fpin);
printf("ondisk: deleting %s\n", infile);
// printf("ondisk: deleting %s\n", infile);
gk_rmpath(infile);

graph->gID = 0;
graph->ondisk = 0;
return;

ERROR:
error:
fclose(fpin);
gk_rmpath(infile);
graph->ondisk = 0;
Expand Down
1 change: 1 addition & 0 deletions libmetis/kmetis.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void InitKWayPartitioning(ctrl_t *ctrl, graph_t *graph)
options[METIS_OPTION_NITER] = 10;
options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_CUT;
options[METIS_OPTION_NO2HOP] = ctrl->no2hop;
options[METIS_OPTION_ONDISK] = ctrl->ondisk;


ubvec = rmalloc(graph->ncon, "InitKWayPartitioning: ubvec");
Expand Down
12 changes: 6 additions & 6 deletions libmetis/metislib.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@


#include <metis.h>
#include <rename.h>
#include <gklib_defs.h>
#include "rename.h"
#include "gklib_defs.h"

#include <defs.h>
#include <struct.h>
#include <macros.h>
#include <proto.h>
#include "defs.h"
#include "struct.h"
#include "macros.h"
#include "proto.h"


#if defined(COMPILER_MSC)
Expand Down
3 changes: 3 additions & 0 deletions vsgen.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
MKDIR build\windows
MKDIR build\xinclude
COPY include\metis.h build\xinclude
COPY include\CMakeLists.txt build\xinclude
CD build\windows
cmake -DCMAKE_CONFIGURATION_TYPES="Release" ..\.. %*
ECHO VS files have been generated in build\windows
Expand Down

0 comments on commit 5369458

Please sign in to comment.