Skip to content

Commit

Permalink
Merge pull request #85 from LLNL/release-2.0.0
Browse files Browse the repository at this point in the history
Release 2.0.0
  • Loading branch information
mcfadden8 authored Jun 26, 2019
2 parents db7d3b4 + 94b9b36 commit 8c76f25
Show file tree
Hide file tree
Showing 58 changed files with 2,895 additions and 3,145 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.swp
24 changes: 24 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/sphinx/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/sphinx/requirements.txt

63 changes: 63 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services: docker
dist: trusty
language: cpp
env:
global:
- DO_BUILD=yes
- DO_TEST=no
- GTEST_COLOR=1
matrix:
include:
- compiler: gcc5
env:
- COMPILER=g++
- IMG=gcc-5
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- DO_MEMCHECK=no
- compiler: gcc6
env:
- COMPILER=g++
- IMG=gcc-6
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: gcc7
env:
- COMPILER=g++
- IMG=gcc-7
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: gcc8
env:
- COMPILER=g++
- IMG=gcc-8
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: gcc8
env:
- COMPILER=g++
- IMG=gcc-8
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=On"
- compiler: clang4
env:
- COMPILER=clang++
- IMG=clang-4
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: clang5
env:
- COMPILER=clang++
- IMG=clang-5
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: clang6
env:
- COMPILER=clang++
- IMG=clang-6
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=Off"
- compiler: clang6
env:
- COMPILER=clang++
- IMG=clang-6
- CMAKE_EXTRA_FLAGS="-DENABLE_DEBUG_LOGGING=On"

script:
- docker run --rm --user='root' -v ${TRAVIS_BUILD_DIR}:/home/axom axom/compilers:$IMG chown -R axom /home/axom
- docker run --rm -v ${TRAVIS_BUILD_DIR}:/home/axom -e COMPILER -e DO_BUILD -e DO_TEST -e DO_MEMCHECK -e CMAKE_EXTRA_FLAGS -e GTEST_COLOR axom/compilers:$IMG ./scripts/travis/build_and_test.sh

after_success:
- if [[ "${CMAKE_EXTRA_FLAGS}" == *"ENABLE_COVERAGE"* ]] ; then bash <(curl -s https://codecov.io/bash) -a "-f" >& /dev/null; fi
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#############################################################################
cmake_minimum_required (VERSION 3.5.1)
project(umap
VERSION 1.0.0
VERSION 2.0.0
LANGUAGES CXX C
)

Expand All @@ -20,14 +20,9 @@ include(cmake/SetupUmapThirdParty.cmake)
set(UMAP_DEBUG_LOGGING ${ENABLE_LOGGING})
configure_file(
${PROJECT_SOURCE_DIR}/config/config.h.in
${PROJECT_BINARY_DIR}/src/include/config.h)
${PROJECT_BINARY_DIR}/src/umap/config.h)

set (UMAPINCLUDEDIRS
"${CMAKE_BINARY_DIR}/src/include"
"${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_SOURCE_DIR}/src/logging"
"${CMAKE_SOURCE_DIR}/src/store"
)
include_directories ( "${CMAKE_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}/src")

add_subdirectory(src)
add_subdirectory(examples)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UMAP v1.0.0
# UMAP v2.0.0

[![Travis Build Status](https://travis-ci.com/LLNL/umap.svg?branch=develop)](https://travis-ci.com/LLNL/umap)
[![Documentation Status](https://readthedocs.org/projects/llnl-umap/badge/?version=develop)](https://llnl-umap.readthedocs.io/en/develop/?badge=develop)

Umap is a library that provides an mmap()-like interface to a simple, user-
Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
******
UMAP
******
***********
UMAP v2.0.0
***********

Umap is a library that provides an mmap()-like interface to a simple, user-
space page fault handler based on the userfaultfd Linux feature (starting with
Expand Down
64 changes: 40 additions & 24 deletions examples/psort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
#include <omp.h>
#include <cstdio>
#include <cstring>
#include <vector>
#include "errno.h"
#include "umap/umap.h"

using namespace std;

void initialize_and_sort_file( const char* fname, uint64_t arraysize, uint64_t totalbytes )
void
initialize_and_sort_file( const char* fname, uint64_t arraysize, uint64_t totalbytes, uint64_t psize )
{
if ( unlink(fname) ) {
int eno = errno;
if ( eno != ENOENT ) {
cerr << "Failed to unlink " << fname << ": "
<< strerror(eno) << " Errno=" << eno << endl;
std::cerr << "Failed to unlink " << fname << ": "
<< strerror(eno) << " Errno=" << eno << std::endl;
}
}

int fd = open(fname, O_RDWR | O_LARGEFILE | O_DIRECT | O_CREAT, S_IRUSR | S_IWUSR);
if ( fd == -1 ) {
int eno = errno;
cerr << "Failed to create " << fname << ": " << strerror(eno) << endl;
std::cerr << "Failed to create " << fname << ": " << strerror(eno) << std::endl;
return;
}

Expand All @@ -43,82 +43,98 @@ void initialize_and_sort_file( const char* fname, uint64_t arraysize, uint64_t t
int x;
if ( ( x = posix_fallocate(fd, 0, totalbytes) != 0 ) ) {
int eno = errno;
cerr << "Failed to pre-allocate " << fname << ": " << strerror(eno) << endl;
std::cerr << "Failed to pre-allocate " << fname << ": " << strerror(eno) << std::endl;
return;
}
} catch(const std::exception& e) {
std::cerr << "posix_fallocate: " << e.what() << std::endl;
return;
} catch(...) {
int eno = errno;
cerr << "Failed to pre-allocate " << fname << ": " << strerror(eno) << endl;
std::cerr << "Failed to pre-allocate " << fname << ": " << strerror(eno) << std::endl;
return;
}

void* base_addr = umap(NULL, totalbytes, PROT_READ|PROT_WRITE, UMAP_PRIVATE, fd, 0);
if ( base_addr == UMAP_FAILED ) {
int eno = errno;
cerr << "Failed to umap " << fname << ": " << strerror(eno) << endl;
std::cerr << "Failed to umap " << fname << ": " << strerror(eno) << std::endl;
return;
}

std::vector<umap_prefetch_item> pfi;
char* base = (char*)base_addr;
uint64_t PagesInTest = totalbytes / psize;

std::cout << "Prefetching Pages\n";
for ( int i{0}; i < PagesInTest; ++i) {
umap_prefetch_item x = { .page_base_addr = &base[i * psize] };
pfi.push_back(x);
};
umap_prefetch(PagesInTest, &pfi[0]);

uint64_t *arr = (uint64_t *) base_addr;
cout << "Initializing Array\n";

std::cout << "Initializing Array\n";

#pragma omp parallel for
for(uint64_t i=0; i < arraysize; ++i)
arr[i] = (uint64_t) (arraysize - i);

cout << "Sorting Data\n";
std::cout << "Sorting Data\n";
__gnu_parallel::sort(arr, &arr[arraysize], std::less<uint64_t>(), __gnu_parallel::quicksort_tag());


if (uunmap(base_addr, totalbytes) < 0) {
int eno = errno;
cerr << "Failed to uumap " << fname << ": " << strerror(eno) << endl;
std::cerr << "Failed to uumap " << fname << ": " << strerror(eno) << std::endl;
return;
}
close(fd);
}

void verify_sortfile( const char* fname, uint64_t arraysize, uint64_t totalbytes )
void
verify_sortfile( const char* fname, uint64_t arraysize, uint64_t totalbytes )
{
int fd = open(fname, O_RDWR | O_LARGEFILE | O_DIRECT, S_IRUSR | S_IWUSR);
if ( fd == -1 ) {
cerr << "Failed to create " << fname << endl;
std::cerr << "Failed to create " << fname << std::endl;
return;
}

void* base_addr = umap(NULL, totalbytes, PROT_READ|PROT_WRITE, UMAP_PRIVATE, fd, 0);
if ( base_addr == UMAP_FAILED ) {
cerr << "umap failed\n";
std::cerr << "umap failed\n";
return;
}
uint64_t *arr = (uint64_t *) base_addr;

cout << "Verifying Data with\n";
std::cout << "Verifying Data with\n";

#pragma omp parallel for
for(uint64_t i = 0; i < arraysize; ++i)
if (arr[i] != (i+1)) {
cerr << "Data miscompare\n";
std::cerr << "Data miscompare\n";
i = arraysize;
}

if (uunmap(base_addr, totalbytes) < 0) {
cerr << "uunamp failed\n";
std::cerr << "uunamp failed\n";
return;
}
close(fd);
}

int main(int argc, char **argv)
int
main(int argc, char **argv)
{
const char* filename = argv[1];

// Optional: Make umap's pages size double the default system page size
//
uint64_t psize = umap_cfg_get_pagesize() * 2;
umap_cfg_set_pagesize( psize );
// Use UMAP_PAGE_SIZE environment variable to set page size for umap
//
uint64_t psize = umapcfg_get_umap_page_size();

const uint64_t pagesInTest = 64;
const uint64_t elemPerPage = psize / sizeof(uint64_t);
Expand All @@ -129,9 +145,9 @@ int main(int argc, char **argv)
// Optional: Set umap's buffer to half the number of pages we need so that
// we may simulate an out-of-core experience
//
umap_cfg_set_bufsize( pagesInTest / 2 );

initialize_and_sort_file(filename, arraySize, totalBytes);
// Use UMAP_BUFSIZE environment variable to set number of pages in buffer
//
initialize_and_sort_file(filename, arraySize, totalBytes, psize);
verify_sortfile(filename, arraySize, totalBytes);
return 0;
}
36 changes: 36 additions & 0 deletions scripts/travis/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#############################################################################
# Copyright 2017-2019 Lawrence Livermore National Security, LLC and other
# UMAP Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: LGPL-2.1-only
#############################################################################

env
function or_die () {
"$@"
local status=$?
if [[ $status != 0 ]] ; then
echo ERROR $status command: $@
exit $status
fi
}

or_die mkdir travis-build
cd travis-build
if [[ "$DO_BUILD" == "yes" ]] ; then
or_die cmake -DCMAKE_CXX_COMPILER="${COMPILER}" ${CMAKE_EXTRA_FLAGS} ../
if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then
or_die make -j 3
else
or_die make -j 3 VERBOSE=1
fi
if [[ "${DO_TEST}" == "yes" ]] ; then
or_die ctest -T test --output-on-failure -V
fi
if [[ "${DO_MEMCHECK}" == "yes" ]] ; then
or_die ctest -T memcheck
fi
fi

exit 0
Loading

0 comments on commit 8c76f25

Please sign in to comment.