Commit be107229 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Removing folder with original implementation of quicksort and bitonic sort.

parent 198c0c31
Loading
Loading
Loading
Loading

GPUSort/.gitignore

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
.vscode
backup
*.csv
*.o
*.cuo
*.ipynb
 No newline at end of file

GPUSort/GPUSort/README.MD

deleted100644 → 0
+0 −22
Original line number Diff line number Diff line
## Code implemented by Nguyen Xuan Thang for bachelor thesis

Needs to have CUDA and TNL installed.

* benchmark
    * folder containing benchmarking scripts
    * the main function is in ``benchmarker.cpp``
    * for each implemented algorithm, there is a folder with a benchmarker and a Makefile, to test out the algorithm, run ``make run``, to clean up ``make clean``
* src
    * folder containing the implementation of Bitonic sort, Quick sort and CDP Quick sort
    * inside each folder there is a ``sample`` folder
        * to test out the algorithm, simply run ``make run``
* tests
    * folder containing unit tests for each algorithm
    * inside each folder there is a tester and a Makefile
        * to test out the implementation, run ``make run``
    * needs gTests installed



* To install TNL, read https://mmg-gitlab.fjfi.cvut.cz/doc/tnl/#installation
* To install CUDA, https://developer.nvidia.com/cuda-downloads
+0 −27
Original line number Diff line number Diff line
include ../../src/util/config.mk

CUDA_SOURCES := $(wildcard *.cu)
CUDA_TARGETS := $(CUDA_SOURCES:%.cu=%)

## targets definitions follow
.PHONY: all host cuda
all: cuda
cuda: $(CUDA_TARGETS)

run: cuda
	./$(CUDA_TARGETS)

measure: cuda
	./$(CUDA_TARGETS) ../bitonic.csv

.PHONY: clean
clean:
	rm -f *.d *.o *.cuo $(CUDA_TARGETS)

# use .cuo instead of .cu.o to avoid problems with the implicit rules: https://stackoverflow.com/q/62967939
# (and use the host compiler for linking CUDA, nvcc does not understand that .cuo is an object file)
$(CUDA_TARGETS): % : %.cuo
	$(CXX) $(CUDA_LDFLAGS) -o $@ $< $(CUDA_LDLIBS)

$(CUDA_SOURCES:%.cu=%.cuo): %.cuo : %.cu
	$(CUDA_CXX) $(CUDA_CPPFLAGS) $(CUDA_CXXFLAGS) -c -o $@ $<
+0 −32
Original line number Diff line number Diff line
include ../../src/util/config.mk

CUDA_SOURCES := $(wildcard *.cu)
CUDA_TARGETS := $(CUDA_SOURCES:%.cu=%)

## targets definitions follow
.PHONY: all host cuda
all: cuda
cuda: $(CUDA_TARGETS)

run: cuda
	./$(CUDA_TARGETS)
	
measure: cuda
	./$(CUDA_TARGETS) ../quicksort.csv

.PHONY: clean
clean:
	rm -f *.d *.o *.cuo $(CUDA_TARGETS)

# use .cuo instead of .cu.o to avoid problems with the implicit rules: https://stackoverflow.com/q/62967939
# (and use the host compiler for linking CUDA, nvcc does not understand that .cuo is an object file)
$(CUDA_TARGETS): % : %.cuo
	$(CXX) $(CUDA_LDFLAGS) -o $@ $< $(CUDA_LDLIBS)

$(CUDA_SOURCES:%.cu=%.cuo): %.cuo : %.cu
	$(CUDA_CXX) $(CUDA_CXXFLAGS) -c -o $@ $<

debug:
	$(CUDA_CXX) -DCHECK_RESULT_SORT $(CUDA_CXXFLAGS) -c -o benchmark.cuo benchmark.cu
	$(CXX) $(CUDA_LDFLAGS) -o benchmark benchmark.cuo $(CUDA_LDLIBS)
	./benchmark
 No newline at end of file
+0 −35
Original line number Diff line number Diff line
include ../../src/util/config.mk

TARGET := benchmark
EXTRA_ARCH := -gencode arch=compute_52,code=sm_52
DEVICE_CODE := -dc

CUDA_LDLIBS += -lcudadevrt

SRC_FOLDER := ../../src/quicksort_dynamic

## targets definitions follow
.PHONY: cuda
all: cuda

cuda: $(TARGET)

.PHONY: cuda
run: cuda
	./$(TARGET)
	
.PHONY: clean
clean:
	rm -f *.d *.o *.cuo $(TARGET)

$(TARGET): quicksort.o quicksort_link.o $(TARGET).o
	$(CXX) $(TNL_INCLUDE_DIRS) $(CUDA_LDFLAGS) -o $@ $^ $(CUDA_LDLIBS)

$(TARGET).o: $(TARGET).cu ../benchmarker.cpp
	$(CUDA_CXX) $(CUDA_CXXFLAGS) -c -o $@ $<

quicksort.o: $(SRC_FOLDER)/quicksort.cu
	$(CUDA_CXX) $(CUDA_CXXFLAGS) $(EXTRA_ARCH) $(DEVICE_CODE) -c -o $@ $<

quicksort_link.o: quicksort.o
	$(CUDA_CXX) $(CUDA_LDFLAGS) -dlink -o $@ $< $(CUDA_LDLIBS)
Loading