Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #30 from Intel-HLS/dev
Browse files Browse the repository at this point in the history
Clang Support, Advanced I/O, Improved Performance and Bug Fixes
  • Loading branch information
stavrospapadopoulos authored Jun 21, 2016
2 parents bc773aa + a8f124b commit 058d9bb
Show file tree
Hide file tree
Showing 45 changed files with 4,474 additions and 1,439 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ before_script:
- lcov --directory . --zerocounters

script:
- make -j 4
- make test
- make CXX=mpic++ INCLUDE_PATHS=-I/usr/include/mpich MPILIB=-lmpich -j 4
- make test CXX=mpic++ INCLUDE_PATHS=-I/usr/include/mpich MPILIB=-lmpich
- lcov --directory . --capture --output-file coverage.info
- lcov --list coverage.info # debug before upload

Expand Down
54 changes: 25 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# **************** #

OS := $(shell uname)
ifneq ($(shell gcc -v 2>&1 | grep -c "clang"),0)
COMPILER := clang
else
COMPILER := gcc
endif

# --- Configuration flags --- #
CPPFLAGS = -std=gnu++11 -fPIC -fvisibility=hidden \
Expand All @@ -13,22 +18,11 @@ ifdef TRAVIS
CPPFLAGS += --coverage
endif

# --- Use of mmap function for reading --- #
USE_MMAP =
ifeq ($(USE_MMAP),)
USE_MMAP = 1
endif
ifeq ($(USE_MMAP),1)
CPPFLAGS += -D_TILEDB_USE_MMAP
endif

# --- Parallel sort --- #
GNU_PARALLEL =
ifeq ($(GNU_PARALLEL),)
GNU_PARALLEL = 1
endif
ifeq ($(GNU_PARALLEL),1)
CPPFLAGS += -DGNU_PARALLEL
# --- Support for OpenMP --- #
OPENMP_FLAG =
ifeq ($(COMPILER), gcc)
CPPFLAGS += -DOPENMP
OPENMP_FLAG = -fopenmp
endif

# --- Debug/Release mode handler --- #
Expand All @@ -42,7 +36,7 @@ ifeq ($(BUILD),release)
endif

ifeq ($(BUILD),debug)
CPPFLAGS += -DDEBUG -gdwarf-3 -g3 -Wall
CPPFLAGS += -DDEBUG -gdwarf-3 -g3 -Wall
endif

# --- Verbose mode handler --- #
Expand Down Expand Up @@ -107,7 +101,7 @@ DOXYGEN_DIR = doxygen
DOXYGEN_MAINPAGE = $(DOXYGEN_DIR)/mainpage.dox

# --- Paths --- #
INCLUDE_PATHS =
INCLUDE_PATHS =
CORE_INCLUDE_PATHS = $(addprefix -I, $(CORE_INCLUDE_SUBDIRS))
EXAMPLES_INCLUDE_PATHS = -I$(EXAMPLES_INCLUDE_DIR)
TEST_INCLUDE_PATHS = $(addprefix -I, $(CORE_INCLUDE_SUBDIRS))
Expand All @@ -121,6 +115,7 @@ endif
ZLIB = -lz
OPENSSLLIB = -lcrypto
GTESTLIB = -lgtest -lgtest_main
MPILIB =

# --- For the TileDB dynamic library --- #
ifeq ($(OS), Darwin)
Expand Down Expand Up @@ -179,7 +174,7 @@ $(CORE_OBJ_DIR)/%.o: $(CORE_SRC_DIR)/%.cc
@mkdir -p $(dir $@)
@echo "Compiling $<"
@$(CXX) $(CPPFLAGS) $(INCLUDE_PATHS) $(CORE_INCLUDE_PATHS) -c $< -o $@
@$(CXX) -MM $(CORE_INCLUDE_PATHS) $< > $(@:.o=.d)
@$(CXX) -MM $(CORE_INCLUDE_PATHS) $(INCLUDE_PATHS) $< > $(@:.o=.d)
@mv -f $(@:.o=.d) $(@:.o=.d.tmp)
@sed 's|.*:|$@:|' < $(@:.o=.d.tmp) > $(@:.o=.d)
@rm -f $(@:.o=.d.tmp)
Expand Down Expand Up @@ -214,8 +209,8 @@ endif
$(CORE_LIB_DIR)/libtiledb.$(SHLIB_EXT): $(CORE_OBJ)
@mkdir -p $(CORE_LIB_DIR)
@echo "Creating dynamic library libtiledb.$(SHLIB_EXT)"
@$(CXX) $(SHLIB_FLAGS) $(SONAME) -o $@ $^ $(LIBRARY_PATHS) $(ZLIB) \
$(OPENSSLLIB) -fopenmp
@$(CXX) $(SHLIB_FLAGS) $(SONAME) -o $@ $^ $(LIBRARY_PATHS) $(MPILIB) \
$(ZLIB) $(OPENSSLLIB) $(OPENMP_FLAG)

$(CORE_LIB_DIR)/libtiledb.a: $(CORE_OBJ)
@mkdir -p $(CORE_LIB_DIR)
Expand All @@ -239,11 +234,11 @@ clean_libtiledb:
$(EXAMPLES_OBJ_DIR)/%.o: $(EXAMPLES_SRC_DIR)/%.cc
@mkdir -p $(EXAMPLES_OBJ_DIR)
@echo "Compiling $<"
@$(CXX) $(CPPFLAGS) -fopenmp $(INCLUDE_PATHS) \
@$(CXX) $(CPPFLAGS) $(OPENMP_FLAG) $(INCLUDE_PATHS) \
$(EXAMPLES_INCLUDE_PATHS) \
$(CORE_INCLUDE_PATHS) -c $< -o $@
@$(CXX) -MM $(EXAMPLES_INCLUDE_PATHS) \
$(CORE_INCLUDE_PATHS) $< > $(@:.o=.d)
$(CORE_INCLUDE_PATHS) $(INCLUDE_PATHS) $< > $(@:.o=.d)
@mv -f $(@:.o=.d) $(@:.o=.d.tmp)
@sed 's|.*:|$@:|' < $(@:.o=.d.tmp) > $(@:.o=.d)
@rm -f $(@:.o=.d.tmp)
Expand All @@ -253,8 +248,8 @@ $(EXAMPLES_OBJ_DIR)/%.o: $(EXAMPLES_SRC_DIR)/%.cc
$(EXAMPLES_BIN_DIR)/%: $(EXAMPLES_OBJ_DIR)/%.o $(CORE_LIB_DIR)/libtiledb.a
@mkdir -p $(EXAMPLES_BIN_DIR)
@echo "Creating $@"
@$(CXX) -std=gnu++11 -o $@ $^ $(LIBRARY_PATHS) $(ZLIB) $(OPENSSLLIB) \
-fopenmp
@$(CXX) -std=gnu++11 -o $@ $^ $(LIBRARY_PATHS) $(MPILIB) $(ZLIB) \
$(OPENSSLLIB) $(OPENMP_FLAG)

# --- Cleaning --- #

Expand All @@ -274,9 +269,10 @@ clean_examples:
$(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cc
@mkdir -p $(dir $@)
@echo "Compiling $<"
@$(CXX) $(CPPFLAGS) -fopenmp $(TEST_INCLUDE_PATHS) -c $< -o $@
@$(CXX) $(CPPFLAGS) $(OPENMP_FLAG) $(TEST_INCLUDE_PATHS) \
$(INCLUDE_PATHS) -c $< -o $@
@$(CXX) -MM $(TEST_INCLUDE_PATHS) \
$(CORE_INCLUDE_PATHS) $< > $(@:.o=.d)
$(CORE_INCLUDE_PATHS) $(INCLUDE_PATHS) $< > $(@:.o=.d)
@mv -f $(@:.o=.d) $(@:.o=.d.tmp)
@sed 's|.*:|$@:|' < $(@:.o=.d.tmp) > $(@:.o=.d)
@rm -f $(@:.o=.d.tmp)
Expand All @@ -286,8 +282,8 @@ $(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cc
$(TEST_BIN_DIR)/tiledb_test: $(TEST_OBJ) $(CORE_LIB_DIR)/libtiledb.a
@mkdir -p $(TEST_BIN_DIR)
@echo "Creating test_cmd"
@$(CXX) -std=gnu++11 -o $@ $^ $(LIBRARY_PATHS) $(ZLIB) $(OPENSSLLIB) \
$(GTESTLIB) -fopenmp
@$(CXX) -std=gnu++11 -o $@ $^ $(LIBRARY_PATHS) $(MPILIB) $(ZLIB) \
$(OPENSSLLIB) $(GTESTLIB) $(OPENMP_FLAG)

# --- Cleaning --- #

Expand Down
96 changes: 96 additions & 0 deletions core/include/array/aio_request.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @file aio_request.h
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2016 MIT and Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @section DESCRIPTION
*
* This file declares the AIO_Request struct.
*/

#ifndef __AIO_REQUEST_H__
#define __AIO_REQUEST_H__

#include <stdio.h>

/** Describes an AIO (read or write) request. */
struct AIO_Request {
/**
* An array of buffers, one for each attribute. These must be
* provided in the same order as the attributes specified in
* array initialization or when resetting the attributes. The case of
* variable-sized attributes is special. Instead of providing a single
* buffer for such an attribute, **two** must be provided: the second
* will hold the variable-sized cell values, whereas the first holds the
* start offsets of each cell in the second buffer.
*/
void** buffers_;
/**
* The sizes (in bytes) allocated by the user for the input
* buffers (there is a one-to-one correspondence). The function will attempt
* to write as many results as can fit in the buffers, and potentially
* alter the buffer size to indicate the size of the *useful* data written
* in the buffer.
*/
size_t* buffer_sizes_;
/** Function to be called upon completion of the request. */
void *(*completion_handle_) (void*);
/** Data to be passed to the completion handle. */
void* completion_data_;
/** A unique request id. */
size_t id_;
/**
* Applicable only to read requests.
* Indicates whether a buffer has overflowed during a read request.
* If it is NULL, it will be ignored. Otherwise, it must be an array
* with as many elements as the number of buffers above.
*/
bool* overflow_;
/**
* The status of the AIO request. It can be one of the following:
* - TILEDB_AIO_COMPLETED
* The request is completed.
* - TILEDB_AIO_INPROGRESS
* The request is still in progress.
* - TILEDB_AIO_OVERFLOW
* At least one of the input buffers overflowed (applicable only to AIO
* read requests)
* - TILEDB_AIO_ERR
* The request caused an error (and thus was canceled).
*/
int* status_;
/**
* The subarray in which the array read/write will be
* constrained on. It should be a sequence of [low, high] pairs (one
* pair per dimension), whose type should be the same as that of the
* coordinates. If it is NULL, then the subarray is set to the entire
* array domain. For the case of writes, this is meaningful only for
* dense arrays, and specifically dense writes.
*/
const void* subarray_;
};

#endif

Loading

0 comments on commit 058d9bb

Please sign in to comment.