Skip to content

Commit

Permalink
Merge pull request #21 from LLNL/release_0.0.2
Browse files Browse the repository at this point in the history
Release 0.0.2
  • Loading branch information
mcfadden8 committed Mar 29, 2018
2 parents 39924d1 + 76f815a commit f68e6cb
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 16 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cmake_minimum_required (VERSION 3.5.1)
project(umap VERSION 0.0.1)
project(umap VERSION 0.0.2)

configure_file(
"${PROJECT_SOURCE_DIR}/config/config.h.in"
"${PROJECT_BINARY_DIR}/config/config.h"
)

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Debug")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# UMAP v0.0.1 (alpha)
# UMAP v0.0.2 (alpha)

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
7 changes: 7 additions & 0 deletions config/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// the (cmake) configured options and settings for umap
#ifndef _UMAP_UMAPCONFIG_H
#define _UMAP_UMAPCONFIG_H
#define UMAP_VERSION_MAJOR @umap_VERSION_MAJOR@
#define UMAP_VERSION_MINOR @umap_VERSION_MINOR@
#define UMAP_VERSION_PATCH @umap_VERSION_PATCH@
#endif
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ set_target_properties(libumap_static PROPERTIES OUTPUT_NAME libumap)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

include_directories( BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../sysincludes )
include_directories(
BEFORE "${CMAKE_CURRENT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}/../config"
"${CMAKE_CURRENT_SOURCE_DIR}/../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../sysincludes"
)

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)

Expand Down
7 changes: 4 additions & 3 deletions src/umap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
#include <sys/prctl.h>
#include "umap.h" // API to library
#include "umaplog.h" // umap_log()
#include "config.h"

using namespace std;

const int UMAP_VERSION_MAJOR = 0;
const int UMAP_VERSION_MINOR = 0;
const int UMAP_VERSION_PATCH = 1;
const int umap_Version_Major = UMAP_VERSION_MAJOR;
const int umap_Version_Minor = UMAP_VERSION_MINOR;
const int umap_Version_Patch = UMAP_VERSION_PATCH;

static const int UMAP_UFFD_MAX_MESSAGES = 256;
static unsigned int uffd_threads;
Expand Down
16 changes: 8 additions & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
add_subdirectory(libumaptest)
add_subdirectory(umapcpu)
# add_subdirectory(umapcpu)
add_subdirectory(umapsort)
add_subdirectory(umaptest)
add_subdirectory(umapmillions)
add_subdirectory(median)
add_subdirectory(readload)
add_subdirectory(uffd_test)
add_subdirectory(churn)
add_subdirectory(rwseq)
# add_subdirectory(umaptest)
# add_subdirectory(umapmillions)
# add_subdirectory(median)
# add_subdirectory(readload)
# add_subdirectory(uffd_test)
# add_subdirectory(churn)
# add_subdirectory(rwseq)
if (BUILD_FITS)
add_subdirectory(FITS)
endif()
4 changes: 2 additions & 2 deletions tests/libumaptest/mmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void* umt_openandmap_mf(const umt_optstruct_t* testops, uint64_t numbytes, void*
const int prot = PROT_READ|PROT_WRITE;

if ( testops->usemmap ) {
void* next_mmap = mmap(NULL, handle->total_range_size, prot, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
void* next_mmap = mmap(NULL, handle->total_range_size, prot, MAP_SHARED | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
if (next_mmap == MAP_FAILED) {
ostringstream ss;
ss << "reservation (mmap) of " << handle->total_range_size << " bytes failed: ";
Expand All @@ -162,7 +162,7 @@ void* umt_openandmap_mf(const umt_optstruct_t* testops, uint64_t numbytes, void*

for ( int i = 0; i < testops->num_files; ++i ) {
void* mmap_region;
mmap_region = mmap(next_mmap, handle->mf_files[i].data_size, prot, MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE, handle->mf_files[i].fd, offset);
mmap_region = mmap(next_mmap, handle->mf_files[i].data_size, prot, MAP_SHARED | MAP_FIXED | MAP_NORESERVE, handle->mf_files[i].fd, offset);
if (mmap_region == MAP_FAILED) {
ostringstream ss;
ss << "mmap of " << handle->mf_files[i].data_size << " bytes failed for " << handle->files[i] << ": ";
Expand Down
10 changes: 10 additions & 0 deletions tests/umapsort/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ project(umapsort)

FIND_PACKAGE( OpenMP REQUIRED )
if(OPENMP_FOUND)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/perftest_mmap.sh"
"${CMAKE_CURRENT_BINARY_DIR}/perftest_mmap.sh"
COPYONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/perftest_umap.sh"
"${CMAKE_CURRENT_BINARY_DIR}/perftest_umap.sh"
COPYONLY
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
Expand Down
86 changes: 86 additions & 0 deletions tests/umapsort/perftest_mmap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
function free_mem {
m=`grep MemFree /proc/meminfo | awk -v N=2 '{print $N}'`
fm=$(((${m}/1024)/1024))
echo $fm GB Free
}

function drop_page_cache {
echo "Dropping page cache"
echo 3 > /proc/sys/vm/drop_caches
}

function disable_swap {
echo "Disabling swap"
swapoff -av
}

function set_readahead {
fs=`mount | grep intel | cut -d " " -f 1`
blockdev --setra $readahead $fs
ra=`blockdev --getra $fs`
echo "Read ahead set to $ra for $fs"
}

function amounttowaste {
m=`grep MemFree /proc/meminfo | awk -v N=2 '{print $N}'`
echo $m
fm=$(((${m}/1024)/1024))
waste=$((${fm}-${memtoleave}))
echo $fm GB Available, Wasting $waste GB
}

function setuptmpfs {
if [ ! -d /mnt/tmpfs ]; then
mkdir -p /mnt/tmpfs
fi

# Unmount / Reset of already mounted
fs=`stat -f -c '%T' /mnt/tmpfs`

if [ "$fs" = "tmpfs" ]; then
echo "Resetting tmpfs"
umount /mnt/tmpfs
fi

fs=`stat -f -c '%T' /mnt/tmpfs`
if [ "$fs" != "tmpfs" ]; then
if [ ! -d /mnt/tmpfs ]; then
mkdir -p /mnt/tmpfs
fi
chmod go+rwx /mnt/tmpfs
mount -t tmpfs -o size=600g tmpfs /mnt/tmpfs
fs=`stat -f -c '%T' /mnt/tmpfs`
echo "/mnt/tmpfs mounted as: $fs"
else
echo "Unable to reset /mnt/tmpfs, exiting"
exit 1
fi
}

function waste_memory {
echo "Wasting $waste GB of memory"
echo dd if=/dev/zero of=/mnt/tmpfs/${waste}GB bs=4096 count=$((${waste}*256*1024))
dd if=/dev/zero of=/mnt/tmpfs/${waste}GB bs=4096 count=$((${waste}*256*1024))
}

memtoleave=$((64+6))
readahead=256

set_readahead
disable_swap
setuptmpfs
drop_page_cache
amounttowaste
waste_memory

for t in 128 64 32 16
do
rm -f /mnt/intel/sort_perf_data
drop_page_cache
free_mem
cmd="./umapsort --usemmap --directio -f /mnt/intel/sort_perf_data -p $(((96*1024*1024*1024)/4096)) -n 1 -b $(((64*1024*1024*1024)/4096)) -t $t"
date
echo $cmd
time sh -c "$cmd"
done
86 changes: 86 additions & 0 deletions tests/umapsort/perftest_umap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
function free_mem {
m=`grep MemFree /proc/meminfo | awk -v N=2 '{print $N}'`
fm=$(((${m}/1024)/1024))
echo $fm GB Free
}

function drop_page_cache {
echo "Dropping page cache"
echo 3 > /proc/sys/vm/drop_caches
}

function disable_swap {
echo "Disabling swap"
swapoff -av
}

function set_readahead {
fs=`mount | grep intel | cut -d " " -f 1`
blockdev --setra $readahead $fs
ra=`blockdev --getra $fs`
echo "Read ahead set to $ra for $fs"
}

function amounttowaste {
m=`grep MemFree /proc/meminfo | awk -v N=2 '{print $N}'`
echo $m
fm=$(((${m}/1024)/1024))
waste=$((${fm}-${memtoleave}))
echo $fm GB Available, Wasting $waste GB
}

function setuptmpfs {
if [ ! -d /mnt/tmpfs ]; then
mkdir -p /mnt/tmpfs
fi

# Unmount / Reset of already mounted
fs=`stat -f -c '%T' /mnt/tmpfs`

if [ "$fs" = "tmpfs" ]; then
echo "Resetting tmpfs"
umount /mnt/tmpfs
fi

fs=`stat -f -c '%T' /mnt/tmpfs`
if [ "$fs" != "tmpfs" ]; then
if [ ! -d /mnt/tmpfs ]; then
mkdir -p /mnt/tmpfs
fi
chmod go+rwx /mnt/tmpfs
mount -t tmpfs -o size=600g tmpfs /mnt/tmpfs
fs=`stat -f -c '%T' /mnt/tmpfs`
echo "/mnt/tmpfs mounted as: $fs"
else
echo "Unable to reset /mnt/tmpfs, exiting"
exit 1
fi
}

function waste_memory {
echo "Wasting $waste GB of memory"
echo dd if=/dev/zero of=/mnt/tmpfs/${waste}GB bs=4096 count=$((${waste}*256*1024))
dd if=/dev/zero of=/mnt/tmpfs/${waste}GB bs=4096 count=$((${waste}*256*1024))
}

memtoleave=$((64+6))
readahead=0

set_readahead
disable_swap
setuptmpfs
drop_page_cache
amounttowaste
waste_memory

for t in 128 64 32 16
do
rm -f /mnt/intel/sort_perf_data
drop_page_cache
free_mem
cmd="./umapsort --directio -f /mnt/intel/sort_perf_data -p $(((96*1024*1024*1024)/4096)) -n 1 -b $(((64*1024*1024*1024)/4096)) -t $t"
date
echo $cmd
time sh -c "$cmd"
done

0 comments on commit f68e6cb

Please sign in to comment.