Skip to content

Commit

Permalink
v0.8 changes (#48)
Browse files Browse the repository at this point in the history
* Multiple bug fixes in parCon and parRSB
* Added CI tests for parCon and parRSB
* Refactor examples
* Added I/O routines for `.re2`, `.co2` and `.ma2` files
  • Loading branch information
stgeke authored Aug 28, 2021
1 parent bfb318c commit b3a9449
Show file tree
Hide file tree
Showing 67 changed files with 2,578 additions and 3,298 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: parRSB CI Tests
on: [push, pull_request]
env:
GITHUB.TOKEN: ${{ secrets.token }}
jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
test: [box_2x2x2, pyramid, tgv, e3q, solid, ethier, vortex, expansion]
np: [1, 2, 3, 4]
fail-fast: false
name: "${{ matrix.test }}"
env:
GSVER: 1.0.7
CC: mpicc
steps:
- uses: actions/checkout@v2
- name: Install apt dependencies
shell: bash
run: |
sudo apt -y update
sudo apt install -y mpich libmpich-dev python3-pytest
sudo apt install -y libblas-dev liblapack-dev
- name: Build gslib
shell: bash
run: |
wget --no-check-certificate -O v$GSVER.tar.gz http://github.com/gslib/gslib/archive/v$GSVER.tar.gz
mkdir gslib
tar -zxvf v$GSVER.tar.gz -C ./gslib --strip-components=1
cd gslib
make -j4
- name: Build parRSB
shell: bash
run: |
export GSLIBPATH=`pwd`/gslib/build/
make -j1
- name: Clone tests
shell: bash
run: |
git clone https://github.com/thilinarmtb/parRSB-tests.git
- name: gencon
shell: bash
run: |
export EXAMPLEDIR=`pwd`/build/examples
cd parRSB-tests/${{ matrix.test }}
tol=(`cat test.txt | grep tol`); tol=${tol[2]}
echo "localhost:4" > hostfile
mpirun -np ${{ matrix.np }} --hostfile hostfile ${EXAMPLEDIR}/gencon --mesh ${{ matrix.test }} --tol=${tol} --no-dump --test
- name: genmap
shell: bash
run: |
export EXAMPLEDIR=`pwd`/build/examples
export PARRSB_RSB_PRE=0
export PARRSB_RSB_ALGO=0
cd parRSB-tests/${{ matrix.test }}
tol=(`cat test.txt | grep tol`); tol=${tol[2]}
echo "localhost:4" > hostfile
mpirun -np ${{ matrix.np }} --hostfile hostfile ${EXAMPLEDIR}/genmap --mesh ${{ matrix.test }} --tol=${tol} --no-dump --test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019, UCHICAGO ARGONNE, LLC.
Copyright (c) 2019 - 2021, UCHICAGO ARGONNE, LLC.

The UChicago Argonne, LLC as Operator of Argonne National
Laboratory holds copyright in the Software. The copyright holder
Expand Down
33 changes: 13 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ DEBUG ?= 0
MPI ?= 1
CC ?= mpicc
CFLAGS ?= -g -O0
BLAS ?= 1
UNDERSCORE ?= 1
SYNC_BY_REDUCTION ?= 1
BLAS ?= 0
BLASDIR ?=
BLASFLAGS ?= -lblas -llapack

## Don't touch what follows ##
MKFILEPATH = $(abspath $(lastword $(MAKEFILE_LIST)))
Expand All @@ -29,10 +32,6 @@ GENCONDIR = $(SRCROOT)/src/gencon
GENCONSRCS = $(wildcard $(GENCONDIR)/*.c)
SRCOBJS += $(patsubst $(SRCROOT)/%.c,$(BUILDDIR)/%.o,$(GENCONSRCS))

TESTDIR = $(SRCROOT)/tests
TESTSRCS = $(wildcard $(TESTDIR)/*.c)
TESTOBJS = $(patsubst $(SRCROOT)/%.c,$(BUILDDIR)/%,$(TESTSRCS))

EXAMPLEDIR = $(SRCROOT)/examples
EXAMPLESRCS = $(wildcard $(EXAMPLEDIR)/*.c)
EXAMPLEOBJS = $(patsubst $(SRCROOT)/%.c,$(BUILDDIR)/%,$(EXAMPLESRCS))
Expand All @@ -55,32 +54,27 @@ endif

ifneq ($(BLAS),0)
PP += -DGENMAP_BLAS
LDFLAGS += -L$(BLASLIBPATH) -lblasLapack -lgfortran
endif

ifneq ($(UNDERSCORE),0)
PP += -DGENMAP_UNDERSCORE
endif

ifneq ($(BLAS),0)
PP += -DGENMAP_BLAS
LDFLAGS += -L$(BLASLIBPATH) -lblasLapack
ifneq ($(BLASDIR),)
LDFLAGS+= -L$(BLASDIR)
endif
LDFLAGS += $(BLASFLAGS)
endif

ifneq ($(MPI),0)
PP += -DMPI
endif

ifneq ($(SYNC_BY_REDUCTION),0)
PP += -DGENMAP_SYNC_BY_REDUCTION
endif

INSTALLDIR=
ifneq (,$(strip $(DESTDIR)))
INSTALLDIR = $(realpath $(DESTDIR))
endif

.PHONY: default
default: check lib examples install

.PHONY: all
all: check lib tests examples install
all: check lib examples install

.PHONY: check
check:
Expand Down Expand Up @@ -132,5 +126,4 @@ print-%:
$(shell mkdir -p $(BUILDDIR)/src/sort)
$(shell mkdir -p $(BUILDDIR)/src/precond)
$(shell mkdir -p $(BUILDDIR)/src/gencon)
$(shell mkdir -p $(BUILDDIR)/tests)
$(shell mkdir -p $(BUILDDIR)/examples)
55 changes: 40 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,31 @@ instructions there to build it.

### Run Example

You can run both `genmap` and `gencon` examples in `build/examples` directory after
building parRSB. Examples invoked with all available options are shown below.

```sh

cd example
mpirun -np 4 ./partition 2 case01.co2
cd build/examples
mpirun -np 4 ./genmap --mesh ethier --nactive=2 --tol=0.2 --test --no-dump
mpirun -np 4 ./gencon --mesh ethier --tol=0.2 --test --no-dump
```

`--mesh` is the name of the input mesh (.re2 file) and is required. `--tol` is the
tolerance used for finding connectivity. `--test` will run a check to see if `genmap`
or `gencon` examples passed the builtin tests. If `--no-dump` is not specified, the
examples will write a `.re2` or a `.ma2` file by default. `--nactive` parameter specify
how many MPI ranks are active in the examples. Please note that `--tol` and `--nactive`
requires a `=` sign (since they are optional) while `--mesh` does not need one.

### C Interface

```C
int parRSB_partMesh(int *part, int *seq, long long *vtx, double *coord, int nel,
int nv, parRSB_options *options, MPI_Comm comm);
int parrsb_part_mesh(int *part, int *seq, long long *vtx, double *coord, int nel,
int nv, parrsb_options options, MPI_Comm comm);
```
See `example/partition.c` for an example.
See `example/genmap.c` for an example.
#### Parameters
Expand All @@ -42,23 +53,37 @@ options (in) ... Additional configuration options (See below for a detailed e
comm (in) ... MPI Communicator (size determines number of partitions).
```

`options` is a `struct` of type `parRSB_options` declared in `parRSB.h`.
`options` is a `struct` of type `parrsb_options` declared in `parRSB.h`.
```C
typedef struct {
/* General options */
int global_partitioner; // -1 - None, 0 - RSB, 1 - RCB, 2 - RIB (Default: 0)
int local_partitioner; // -1 - None, 0 - RSB, 1 - RCB, 2 - RIB (Default: -1)
int debug_level; // 0, 1, 2, .. etc (Default: 0)
int print_timing_info; // 0 or 1 (Default: 0)
int partitioner; // 0 - RSB, 1 - RCB, 2 - RIB (Default: 0)
int debug_level; // 0, 1, 2, .. etc (Default: 0)
int profile_level; // 0, 1, 2, .. etc (Default: 0)

/* RSB specific */
int rsb_algo; // 0 - Lanczos, 1 - MG (Default: 0)
int rsb_prepartition; // 0 - None, 1 - RCB , 2 - RIB (Default: 1)
int rsb_grammian; // 0 or 1 (Default: 1)
} parRSB_options;
int rsb_algo; // 0 - Lanczos, 1 - RQI (Default: 0)
int rsb_pre; // 0 - None, 1 - RCB , 2 - RIB (Default: 1)
int rsb_grammian; // 0 or 1 (Default: 0)

/* Other */
int repair; // 0 - No, 1 - Yes (Default: 1)
} parrsb_options;
```

You can use `parrsb_default_options` struct instance to pass default options
to `parRSB_partMesh` routine.
to `parrsb_part_mesh` routine. All of these options can be controlled at runtime
setting up the relevant env. variable to the corresponding value as well. Below
is the list of env. variables:

```
PARRSB_PARTITIONER
PARRSB_DEBUG_LEVEL
PARRSB_PROFILE_LEVEL
PARRSB_RSB_ALGO
PARRSB_RSB_PRE
PARRSB_RSB_GRAMMIAN
PARRSB_REPAIR
```

Note, any initial distribution of mesh elements is valid.
Binary file removed examples/case01.co2
Binary file not shown.
84 changes: 0 additions & 84 deletions examples/conReader.h

This file was deleted.

Binary file removed examples/ethier.co2
Binary file not shown.
Binary file added examples/ethier.re2
Binary file not shown.
Loading

0 comments on commit b3a9449

Please sign in to comment.