Skip to content

Commit

Permalink
Release 1.6 (#78)
Browse files Browse the repository at this point in the history
* Set CMake version to 1.6
* Fix initial demo related issues (Makefile, deprecated MPI symbols)
* Rework README.md
  • Loading branch information
ahueck authored Jun 18, 2021
1 parent 15b4efc commit 0a5d109
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 204 deletions.
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 3.14)

project(typeart
VERSION 1.5
VERSION 1.6
)

set(TYPEART_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
Expand Down
424 changes: 311 additions & 113 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
01_ex
02_ex
toy
toy-stack
libtool.so
types.yaml

9 changes: 4 additions & 5 deletions demo/01_struct_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char** argv) {
MPI_Aint first_var_address;
MPI_Aint second_var_address;

MPI_Datatype array_of_types[COUNT] = {MPI_LB, MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_UB};
MPI_Datatype array_of_types[COUNT - 2] = {MPI_DOUBLE, MPI_DOUBLE, MPI_INT};
MPI_Datatype parttype, fulltype, veltype, postype;

MPI_Status status;
Expand Down Expand Up @@ -92,18 +92,17 @@ int main(int argc, char** argv) {

// MPI_Type_create_struct(COUNT, array_of_blocklengths,
// array_of_displacements, array_of_types, &fulltype);
MPI_Type_create_struct(COUNT - 2, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types + 1,
&parttype);
MPI_Type_create_struct(COUNT - 2, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &fulltype);
MPI_Type_commit(&fulltype);
MPI_Type_free(&parttype);

MPI_Type_create_struct(1, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types + 1, &parttype);
MPI_Type_create_struct(1, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &veltype);
MPI_Type_commit(&veltype);
MPI_Type_free(&parttype);

MPI_Type_create_struct(1, array_of_blocklengths + 2, array_of_displacements + 2, array_of_types + 2, &parttype);
MPI_Type_create_struct(1, array_of_blocklengths + 2, array_of_displacements + 2, array_of_types + 1, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &postype);
MPI_Type_commit(&postype);
MPI_Type_free(&parttype);
Expand Down
9 changes: 4 additions & 5 deletions demo/02_broken_struct_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char** argv) {
MPI_Aint first_var_address;
MPI_Aint second_var_address;

MPI_Datatype array_of_types[COUNT] = {MPI_LB, MPI_INT, MPI_DOUBLE, MPI_DOUBLE, MPI_UB};
MPI_Datatype array_of_types[COUNT - 2] = {MPI_INT, MPI_DOUBLE, MPI_DOUBLE};
MPI_Datatype parttype, fulltype, veltype, postype;

MPI_Status status;
Expand Down Expand Up @@ -86,18 +86,17 @@ int main(int argc, char** argv) {
array_of_displacements[3] = array_of_displacements[2] + sizeof(double) * 3;
array_of_displacements[4] = array_of_displacements[3] + sizeof(double) * 3 + sizeof(void*);

MPI_Type_create_struct(COUNT - 2, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types + 1,
&parttype);
MPI_Type_create_struct(COUNT - 2, array_of_blocklengths + 1, array_of_displacements + 1, array_of_types, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &fulltype);
MPI_Type_commit(&fulltype);
MPI_Type_free(&parttype);

MPI_Type_create_struct(1, array_of_blocklengths + 2, array_of_displacements + 2, array_of_types + 2, &parttype);
MPI_Type_create_struct(1, array_of_blocklengths + 2, array_of_displacements + 2, array_of_types + 1, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &veltype);
MPI_Type_commit(&veltype);
MPI_Type_free(&parttype);

MPI_Type_create_struct(1, array_of_blocklengths + 3, array_of_displacements + 3, array_of_types + 3, &parttype);
MPI_Type_create_struct(1, array_of_blocklengths + 3, array_of_displacements + 3, array_of_types + 2, &parttype);
MPI_Type_create_resized(parttype, array_of_displacements[0], array_of_displacements[COUNT - 1], &postype);
MPI_Type_commit(&postype);
MPI_Type_free(&parttype);
Expand Down
63 changes: 28 additions & 35 deletions demo/Makefile
Original file line number Diff line number Diff line change
@@ -1,55 +1,48 @@
BUILDDIR ?= ../build
# NOTE: env TYPEART_PATH must be set to install base path of TypeART

MPIRUN ?= mpirun
MPICC ?= OMPI_CC=clang mpicc
CC ?= cc
TYPEART_PASS_DIR = $(BUILDDIR)/lib
TYPEART_RUNTIME_DIR = $(BUILDDIR)/runtime
CLFLAGS = -L$(TYPEART_RUNTIME_DIR) -ltypeart-rt
CFLAGS = -Xclang -load -Xclang $(TYPEART_PASS_DIR)/analysis/meminstfinderpass.so -Xclang -load -Xclang $(TYPEART_PASS_DIR)/typeartpass.so -mllvm -alloca-array-only=false -mllvm -typeart-alloca

TYPEART_LIBPATH = ${TYPEART_PATH}/lib
TYPEART_INCPATH = ${TYPEART_PATH}/include

typeart_plugin = -load $(TYPEART_LIBPATH)/meminstfinderpass.so -load $(TYPEART_LIBPATH)/typeartpass.so -typeart
typeart_stack_mode_args = -typeart-no-heap -typeart-alloca -typeart-stats -S
typeart_heap_mode_args = -typeart-no-heap=false -typeart-stats -S

CLFLAGS = -L$(TYPEART_LIBPATH) -ltypeart-rt

all: libtool.so 01_ex 02_ex toy toy-stack toy-nostack
all: libtool.so 01_ex 02_ex toy toy-stack

libtool.so: tool.c
$(MPICC) -I../runtime/ -I../typelib/ $(CLFLAGS) -shared -fPIC $< -o $@
$(MPICC) -I$(TYPEART_INCPATH) $(CLFLAGS) -shared -fPIC $< -o $@

01_ex: 01_struct_example.c
$(MPICC) $(CFLAGS) $(CLFLAGS) $< -o $@ -O1
$(MPICC) -g -O1 -Xclang -disable-llvm-passes -S -emit-llvm $< -o - | opt $(typeart_plugin) $(typeart_heap_mode_args) | opt -O1 -S | opt $(typeart_plugin) $(typeart_stack_mode_args) | llc -x=ir -filetype=obj -o $@.o
$(MPICC) $(CLFLAGS) $@.o -o $@
02_ex: 02_broken_struct_example.c
$(MPICC) $(CFLAGS) $(CLFLAGS) $< -o $@ -O1
03_ex: 03_array_example.c
$(MPICC) $(CFLAGS) $(CLFLAGS) $< -o $@ -O1

toy: toy.c
$(MPICC) -I../runtime/ -I../typelib/ $(CFLAGS) $(CLFLAGS) $< -o $@ -g
$(MPICC) -g -O1 -Xclang -disable-llvm-passes -S -emit-llvm $< -o - | opt $(typeart_plugin) $(typeart_heap_mode_args) | opt -O1 -S | opt $(typeart_plugin) $(typeart_stack_mode_args) | llc -x=ir -filetype=obj -o $@.o
$(MPICC) $(CLFLAGS) $@.o -o $@

toy-stack: toy.c
$(MPICC) -I../runtime/ -I../typelib/ -S -emit-llvm $< -o $@.ll -g
opt -load $(TYPEART_PASS_DIR)/analysis/meminstfinderpass.so -load $(TYPEART_PASS_DIR)/typeartpass.so -typeart -typeart-alloca -alloca-array-only=false < $@.ll -o $@.ll > /dev/null
llc $@.ll -o $@.s
$(MPICC) $(CLFLAGS) $@.s -o $@

toy-nostack: toy.c
$(MPICC) -I../runtime/ -I../typelib/ -DNOSTACK -S -emit-llvm $< -o $@.ll -g
opt -load $(TYPEART_PASS_DIR)/analysis/meminstfinderpass.so -load $(TYPEART_PASS_DIR)/typeartpass.so -typeart < $@.ll -o $@.ll > /dev/null
llc $@.ll -o $@.s
$(MPICC) $(CLFLAGS) $@.s -o $@
$(MPICC) -I$(TYPEART_INCPATH) -g -O1 -Xclang -disable-llvm-passes -S -emit-llvm $< -o - | opt $(typeart_plugin) $(typeart_heap_mode_args) | opt -O1 -S | opt $(typeart_plugin) $(typeart_stack_mode_args) | llc -x=ir -filetype=obj -o $@.o
$(MPICC) $(CLFLAGS) $@.o -o $@

toy: toy.c
$(MPICC) -I$(TYPEART_INCPATH) -DNOSTACK -g -O1 -Xclang -disable-llvm-passes -S -emit-llvm $< -o - | opt $(typeart_plugin) $(typeart_heap_mode_args) | opt -O1 -S | opt $(typeart_plugin) $(typeart_stack_mode_args) | llc -x=ir -filetype=obj -o $@.o
$(MPICC) $(CLFLAGS) $@.o -o $@

runtoy: toy toy-stack toy-nostack
env LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) ./toy
env LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) ./toy-stack
env LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) ./toy-nostack
runtoy: toy toy-stack
env LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_LIBPATH) ./toy
env LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_LIBPATH) ./toy-stack

run: run01 run02 run03
run: run01 run02

run01: 01_ex libtool.so
env LD_PRELOAD=./libtool.so LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) $(MPIRUN) -np 1 01_ex
env LD_PRELOAD=./libtool.so LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_LIBPATH) $(MPIRUN) -np 1 01_ex
run02: 02_ex libtool.so
env LD_PRELOAD=./libtool.so LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) $(MPIRUN) -np 1 02_ex
run03: 03_ex libtool.so
env LD_PRELOAD=./libtool.so LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_RUNTIME_DIR) $(MPIRUN) -np 4 03_ex

env LD_PRELOAD=./libtool.so LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(TYPEART_LIBPATH) $(MPIRUN) -np 1 02_ex

clean:
rm *~ libtool.so 01_ex 02_ex types.yaml
rm *.o libtool.so 01_ex 02_ex toy toy-stack types.yaml
43 changes: 0 additions & 43 deletions demo/applyPass.sh

This file was deleted.

3 changes: 1 addition & 2 deletions lib/mpi_interceptor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ if(${MPI_C_FOUND} AND ${PYTHONINTERP_FOUND})
)

if(ENABLE_TSAN)
target_compile_options(interceptor-rt PRIVATE -fsanitize=thread)
target_link_options(interceptor-rt PRIVATE -fsanitize=thread)
target_tsan_options(typeart-rt)
endif()

target_link_libraries(interceptor-rt
Expand Down

0 comments on commit 0a5d109

Please sign in to comment.