Skip to content

Commit

Permalink
import project
Browse files Browse the repository at this point in the history
  • Loading branch information
mantognini committed Jan 4, 2015
0 parents commit 624b281
Show file tree
Hide file tree
Showing 283 changed files with 5,886 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bin
build
resources/skel
*.log
*.aux
*.toc
*.synctex.gz
Binary file added Image Skeletonisation - data.numbers/Index.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>Template: Blank (2014-02-28 10:53)</string>
<string>M3.2.2-1878-1</string>
</array>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
620FD7AF-D9E8-471B-BB48-D3F36C68B59E
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image Skeletonisation - data.numbers/preview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image Skeletonisation - report.pages/Index.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>Template: 09_School_Report (2014-02-28 10:44)</string>
<string>M5.2.2-1877-1</string>
</array>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04814554-5C89-4945-8F68-49A9666A4801
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image Skeletonisation - report.pages/preview.jpg
Binary file added Image Skeletonisation - report.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Image Skeletonisation - slides.key/Index.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>Template: Black (2014-02-28 09:37)</string>
<string>M6.2.2-1878-1</string>
</array>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4547E3A7-6DD3-4BD3-A656-C85376E4581C
Binary file not shown.
Binary file added Image Skeletonisation - slides.key/preview.jpg
Binary file added Image Skeletonisation - slides.pdf
Binary file not shown.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Image Skeletonisation - Copyright (c) 2014-2015 Marco Antognini <[email protected]>

This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgement in the product documentation would be appreciated but is
not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.
131 changes: 131 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
CXX = clang++-3.5
CXXCFLAGS = -std=c++11 -stdlib=libc++ -Wall -Ofast \
-nostdinc++ -I/usr/local/lib/llvm-3.5/include/c++/v1
CXXLDFLAGS = -L lib/libc++/ -stdlib=libc++ \
-lsfml-system-s -lsfml-graphics-s -lboost_program_options-s -ljpeg-s \
-L/usr/local/lib/llvm-3.5/usr/lib

GXX = g++-4.9
GXXCFLAGS = -std=c++11 -Wall -Ofast
GXXLDFLAGS = -L lib/stdlibc++/ \
-lsfml-system-s -lsfml-graphics-s -lboost_program_options-s -ljpeg-s

NVCC = nvcc
NVCCCFLAGS = -Xcompiler -stdlib=libstdc++ -O3
NVCCLDFLAGS = -L lib/stdlibc++/ -Xcompiler -stdlib=libstdc++ \
-lsfml-system-s -lsfml-graphics-s -lboost_program_options-s -ljpeg-s

SERIALCFLAGS =
SERIALLDFLAGS =

CUDACFLAGS = -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA
CUDALDFLAGS =

TBBCFLAGS = -x c++ -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_TBB \
-I /Developer/NVIDIA/CUDA-6.5/include
TBBLDFLAGS = -ltbb

OMPCFLAGS = -x c++ -fopenmp -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP \
-I /Developer/NVIDIA/CUDA-6.5/include
OMPLDFLAGS = -lgomp

BUILD_DIR = build/
BIN_DIR = bin/

COMMON_DIR = src/common/
SERIAL_DIR = src/serial/
PAR_DIR = src/parallel/

SOURCES_COMMON = main.cpp
SOURCES_SERIAL = Image.cpp Skeleton.cpp
SOURCES_PAR = Image.cu Skeleton.cu
EXECUTABLE_SERIAL = skeleton_serial
EXECUTABLE_CUDA = skeleton_cuda
EXECUTABLE_TBB = skeleton_tbb
EXECUTABLE_OMP = skeleton_omp

SOURCES_COMMON := $(addprefix $(COMMON_DIR)/, $(SOURCES_COMMON))
SOURCES_SERIAL := $(addprefix $(SERIAL_DIR)/, $(SOURCES_SERIAL)) $(SOURCES_COMMON)
SOURCES_PAR := $(addprefix $(PAR_DIR)/, $(SOURCES_PAR)) $(SOURCES_COMMON)
OBJECTS_SERIAL := $(addsuffix .serial.o, $(notdir $(SOURCES_SERIAL)))
OBJECTS_PAR := $(addsuffix .cuda.o, $(notdir $(SOURCES_PAR)))
OBJECTS_TBB := $(addsuffix .tbb.o, $(notdir $(SOURCES_PAR)))
OBJECTS_OMP := $(addsuffix .omp.o, $(notdir $(SOURCES_PAR)))
OBJECTS_SERIAL := $(addprefix $(BUILD_DIR)/, $(OBJECTS_SERIAL))
OBJECTS_PAR := $(addprefix $(BUILD_DIR)/, $(OBJECTS_PAR))
OBJECTS_TBB := $(addprefix $(BUILD_DIR)/, $(OBJECTS_TBB))
OBJECTS_OMP := $(addprefix $(BUILD_DIR)/, $(OBJECTS_OMP))

EXECUTABLES = $(EXECUTABLE_SERIAL) $(EXECUTABLE_CUDA) $(EXECUTABLE_TBB) $(EXECUTABLE_OMP)


## This hack fixes foreach commands below
define \n


endef

all: $(EXECUTABLES)

serial: $(EXECUTABLE_SERIAL)

cuda: $(EXECUTABLE_CUDA)

tbb: $(EXECUTABLE_TBB)

omp: $(EXECUTABLE_OMP)

$(EXECUTABLE_SERIAL): $(OBJECTS_SERIAL)
$(CXX) $(CXXLDFLAGS) $(SERIALLDFLAGS) $(OBJECTS_SERIAL) -o $(BIN_DIR)/$@

$(EXECUTABLE_CUDA): $(OBJECTS_PAR)
$(NVCC) $(NVCCLDFLAGS) $(CUDALDFLAGS) $(OBJECTS_PAR) -o $(BIN_DIR)/$@

$(EXECUTABLE_TBB): $(OBJECTS_TBB)
$(CXX) $(CXXLDFLAGS) $(TBBLDFLAGS) $(OBJECTS_TBB) -o $(BIN_DIR)/$@

$(EXECUTABLE_OMP): $(OBJECTS_OMP)
$(GXX) $(GXXLDFLAGS) $(OMPLDFLAGS) $(OBJECTS_OMP) -o $(BIN_DIR)/$@

$(OBJECTS_SERIAL): $(SOURCES_SERIAL) | dirs
$(foreach file, $?, \
$(CXX) $(CXXCFLAGS) $(SERIALCFLAGS) -I $(COMMON_DIR) -I $(SERIAL_DIR) \
-c $(file) \
-o $(BUILD_DIR)/$(notdir $(addsuffix .serial.o, $(file))) \
${\n} \
)

$(OBJECTS_PAR): $(SOURCES_PAR) | dirs
$(foreach file, $?, \
$(NVCC) $(NVCCCFLAGS) $(CUDACFLAGS) -I $(COMMON_DIR) -I $(PAR_DIR) \
-c $(file) \
-o $(BUILD_DIR)/$(notdir $(addsuffix .cuda.o, $(file))) \
${\n} \
)

$(OBJECTS_TBB): $(SOURCES_PAR) | dirs
$(foreach file, $?, \
$(CXX) $(CXXCFLAGS) $(TBBCFLAGS) -I $(COMMON_DIR) -I $(SERIAL_DIR) \
-c $(file) \
-o $(BUILD_DIR)/$(notdir $(addsuffix .tbb.o, $(file))) \
${\n} \
)

$(OBJECTS_OMP): $(SOURCES_PAR) | dirs
$(foreach file, $?, \
$(GXX) $(GXXCFLAGS) $(OMPCFLAGS) -I $(COMMON_DIR) -I $(SERIAL_DIR) \
-c $(file) \
-o $(BUILD_DIR)/$(notdir $(addsuffix .omp.o, $(file))) \
${\n} \
)

dirs:
mkdir -p $(BUILD_DIR) $(BIN_DIR)

clean:
rm -f $(addprefix $(BIN_DIR)/, $(EXECUTABLES)) $(BUILD_DIR)/*.o

run: $(EXECUTABLES)
./scripts/run.sh


51 changes: 51 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Image Skeletonisation
=====================

A performance comparison with Thrust


Description
-----------

This project was realised during the fall semester 2014 at EPFL for CS-425,
Program parallelisation on PC clusters.

It aims to compare a theoretical analysis of the parallelisation of the image
skeletonisation problem against an actual implementation in C++ using Thrust,
a high level algorithm library with CUDA, TBB and OpenMP backends. The goal is
to compare the speedup of the parallel implementation and highlight the effect
of some hardware properties on the scalability of the performances.

The full report is available in `Image Skeletonisation - report.pdf`.


Build Instructions
------------------

To run all implementations and measure running time, use `make run`. You will
need the software described in the `Hardware & Software Specifications` section
of the report.

Binaries of the required boost, SFML and libjpeg dependencies for Mac OS X are
provided for convenience. If you are not using this operating system or the same
compilers, you will need to build those yourself and potentially edit the
`Makefile`.

Adding `-DENABLE_SAVE_IMAGE` to the compilation flags will enable saving the
skeletonised image and include I/O times in the running time measurement.

Similarly, `-DENABLE_PARALLEL_SHORT_CIRCUIT_WHITE` enable some optimisations
in the parallel implementation. Note that on CUDA this might decrease the
speedup due to thread divergence.


License
-------

The source code included in this project is distributed under the zlib/png
license. Please refer to LICENSE for the full text.

The boost library is distributed under Boost Software License, which is
available in lib/BOOST_LICENSE. The SFML library is distributed under
zlib/png license, which is available in lib/SFML_LICENSE. License for libjpeg is
available in lib/LIBJPEG_LICENSE.
Loading

0 comments on commit 624b281

Please sign in to comment.