Skip to content
Snippets Groups Projects
Commit 7c86cbe4 authored by Maël Madon's avatar Maël Madon
Browse files

Merge branch 'clean_repo' into 'master'

Clean repo

See merge request !4
parents 8c0b0042 9f320dd0
Branches
No related tags found
1 merge request!4Clean repo
Pipeline #4601 passed
Showing
with 15 additions and 837 deletions
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog][changelog].
Batsched adheres to [Semantic Versioning][semver] and its public API is the following.
- Batched's command-line interface.
- The format of Batsched's input files.
- **Important note**: Changes in the Batsim protocol does not impact
Batsched's public API.
[//]: =========================================================================
## [Unreleased]
[//]: =========================================================================
## [1.4.0] - 2020-07-29 - For [Batsim v4.0.0][Batsim v4.0.0]
### Added
- New `fcfs` algorithm (copied from `fcfs_fast`) that takes into account
the resources selector given in parameter.
### Fixed
- The `easy_bf_fast` did not try to backfill previously submitted jobs in many
events (when the priority job could not be executed).
[//]: =========================================================================
## [1.3.0] - 2019-01-15 - For [Batsim v3.0.0][Batsim v3.0.0]
### Added
- CLI: logging verbosity can now be set with `--verbosity`.
### Changed
- Dependencies: added [intervalset](https://framagit.org/batsim/intervalset).
- Dependencies: added [loguru](https://github.com/emilk/loguru).
[//]: =========================================================================
## [1.2.1] - 2018-07-03 - For [Batsim v2.0.0][Batsim v2.0.0]
### Fixed
- The `sleeper` algorithm continued to send requests when the simulation was
finished, which should now be fixed.
- The `easy_bf_fast` algorithm rejected jobs that requested all the machines
if they could not be executed directly after being submitted
([issue 6](https://gitlab.inria.fr/batsim/batsched/issues/6)).
### Changed
- The `submitter` algorithm now also sets metadata for usual jobs.
[//]: =========================================================================
## [1.2.0] - 2018-04-09 - For [Batsim v2.0.0][Batsim v2.0.0]
### Added
- New algorithms:
- ``easy_bf_fast``, which is an efficient (usual) implementation of EASY
backfilling. In contrast with the robust and general ``easy_bf``
implementation, this one does floating-point computation, only handles
jobs will walltimes, use ad-hoc structures for its simple backfilling
mechanism (rather than a general-purpose 2D partition), only handles
the FCFS queue order (rather than sorting the queue at each event),
uses the first reservation of the priority job (rather than compressing
the reservation as soon as possible at each event), and tries to only
call the needed code depending on which event occured.
- ``fcfs_fast``, which is essentially ``easy_bf_fast`` without backfilling.
[//]: =========================================================================
## [1.1.0] - 2018-03-03 - For [Batsim v2.0.0][Batsim v2.0.0]
### Added
- Added minimal bash completion via [taywee/args][taywee/args].
- Added ``--version`` option.
- New algorithms:
- Crasher, whose purpose is to crash :).
This is useful to test execution managers.
- EnergyWatcher, whose purpose is just to query the energy consumption to
Batsim
- Random, whose purpose is notably to test time-sharing.
- Sequencer, which is very simple and whose purpose is to be the base of
other testing algorithms.
- WaitingTimeEstimator, whose purpose is only to test the support of the
``estimate_waiting_time`` QUERY.
### Changed
- Batsched arguments are now parsed by [taywee/args][taywee/args]
rather than [boost::po][boost::po].
- Support Batsim version 2.0.0:
- two-way QUERY/REPLY (+estimate_waiting_time)
- SET_JOB_METADATA
- Changed algorithms:
- Conservative BF now supports the ``estimate_waiting_time`` QUERY.
- Filler now supports a custom mapping and setting job metadata.
- Submitter now supports setting job metadata.
[//]: =========================================================================
## 1.0.0 - 2017-11-20
Initial release.
[//]: =========================================================================
[changelog]: http://keepachangelog.com/en/1.0.0/
[semver]: http://semver.org/spec/v2.0.0.html
[taywee/args]: https://github.com/Taywee/args
[boost::po]: http://www.boost.org/doc/libs/1_66_0/doc/html/program_options.html
[Batsim v2.0.0]: https://batsim.readthedocs.io/en/latest/changelog.html#v2-0-0
[Batsim v3.0.0]: https://batsim.readthedocs.io/en/latest/changelog.html#v3-0-0
[Batsim v4.0.0]: https://batsim.readthedocs.io/en/latest/changelog.html#v4-0-0
[Unreleased]: https://gitlab.inria.fr/batsim/batsched/compare/v1.4.0...master
[1.4.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.3.0...v1.4.0
[1.3.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.2.1...v1.3.0
[1.2.1]: https://gitlab.inria.fr/batsim/batsched/compare/v1.2.0...v1.2.1
[1.2.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.1.0...v1.2.0
[1.1.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.0.0...v1.1.0
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(batsched CXX)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Options
option(enable_warnings "Enable compilation warnings" ON)
option(treat_warnings_as_errors "Treat compilation warnings as compilation errors" OFF)
option(do_coverage "Compile in coverage mode" OFF)
# Build type
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
# Let's enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Coverage
if (do_coverage)
set(coverage_cxxflags "-g -O0 -fprofile-arcs -ftest-coverage")
set(coverage_ldflags "-lgcov --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${coverage_cxxflags}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${coverage_ldflags}")
endif()
# Dependencies
## Boost
find_package(Boost 1.48 REQUIRED COMPONENTS regex locale)
include_directories(${Boost_INCLUDE_DIR})
## Intervalset
find_package(intervalset REQUIRED)
include_directories(${INTERVALSET_INCLUDE_DIR})
## loguru
find_package(loguru REQUIRED)
include_directories(${LOGURU_INCLUDE_DIR})
## pthread (for loguru)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
## GMP
find_package(GMP REQUIRED)
include_directories(${GMP_INCLUDE_DIR})
## RapidJSON
find_package(rapidjson REQUIRED)
include_directories(${RAPIDJSON_INCLUDE_DIRS})
## Redox dependency
find_package(redox REQUIRED)
include_directories(${REDOX_INCLUDE_DIR})
## Redox sub dependencies
find_package(hiredis REQUIRED)
include_directories(${HIREDIS_INCLUDE_DIRS})
find_package(libev REQUIRED)
include_directories(${LIBEV_INCLUDE_DIRS})
# ZeroMQ dependency
find_package(ZMQ REQUIRED)
include_directories(${ZMQ_INCLUDE_DIRS})
file(GLOB batsched_SRC
"src/*.hpp"
"src/*.cpp"
"src/algo/*.hpp"
"src/algo/*.cpp")
add_executable(batsched ${batsched_SRC})
target_link_libraries(batsched ${GMP_LIBRARIES}
${Boost_REGEX_LIBRARY_DEBUG}
${Boost_LOCALE_LIBRARY_DEBUG}
${INTERVALSET_LIBRARY}
${LOGURU_LIBRARIES}
Threads::Threads
${CMAKE_DL_LIBS}
${REDOX_LIBRARY}
${LIBEV_LIBRARY}
${HIREDIS_LIBRARY}
${ZMQ_LIBRARIES})
target_link_libraries(batsched boost_program_options)
# Installation
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/batsched
DESTINATION bin)
# Let's enable warnings if needed
if (enable_warnings)
set(warning_flags " -Wall -Wextra")
if (treat_warnings_as_errors)
set(warning_flags "${warning_flags} -Werror")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_property(TARGET batsched APPEND_STRING PROPERTY COMPILE_FLAGS ${warning_flags})
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_property(TARGET batsched APPEND_STRING PROPERTY COMPILE_FLAGS ${warning_flags})
else()
message(WARNING "Unknown compiler. Warnings should not be enabled correctly.")
set_property(TARGET batsched APPEND_STRING PROPERTY COMPILE_FLAGS ${warning_flags})
endif()
endif()
####################
# Batsched version #
####################
set(default_batsched_version "v1.4.0")
include(GetGitRevisionDescription)
git_describe(batsched_version)
message(STATUS "Batsched version from git: ${batsched_version}")
if(NOT((${batsched_version} STREQUAL "GIT-NOTFOUND") OR
(${batsched_version} STREQUAL "HEAD-HASH-NOTFOUND")))
add_definitions(-DBATSCHED_VERSION=${batsched_version})
else()
message(WARNING "Cannot retrieve Batsched version from git. "
"Using default version ${default_batsched_version}")
add_definitions(-DBATSCHED_VERSION=${default_batsched_version})
endif()
_filedir_batsched() {
_init_completion -n 2> /dev/null
local program comparg
program="${COMP_WORDS[0]}"
comparg="--complete" # replace this with your flag
COMPREPLY=($("$program" "$comparg" bash "$COMP_CWORD" "${COMP_WORDS[@]}" 2> /dev/null))
[[ $COMPREPLY ]] && return
_filedir
}
complete -F _filedir_batsched batsched
# Try to find the GMP librairies
# GMP_FOUND - system has GMP lib
# GMP_INCLUDE_DIR - the GMP include directory
# GMP_LIBRARIES - Libraries needed to use GMP
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
# Already in cache, be silent
set(GMP_FIND_QUIETLY TRUE)
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
find_library(GMP_LIBRARIES NAMES gmp libgmp )
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx )
MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)
# - Try to find ZMQ
# Once done this will define
# ZMQ_FOUND - System has ZMQ
# ZMQ_INCLUDE_DIRS - The ZMQ include directories
# ZMQ_LIBRARIES - The libraries needed to use ZMQ
# ZMQ_DEFINITIONS - Compiler switches required for using ZMQ
find_path ( ZMQ_INCLUDE_DIR zmq.h )
find_library ( ZMQ_LIBRARY NAMES zmq )
set ( ZMQ_LIBRARIES ${ZMQ_LIBRARY} )
set ( ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR} )
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR )
# File got from redox repo, https://github.com/hmartiro/redox.
# Try to find hiredis
# Once done, this will define
#
# HIREDIS_FOUND - system has hiredis
# HIREDIS_INCLUDE_DIRS - hiredis include directories
# HIREDIS_LIBRARIES - libraries need to use hiredis
if(HIREDIS_INCLUDE_DIRS AND HIREDIS_LIBRARIES)
set(HIREDIS_FIND_QUIETLY TRUE)
else()
find_path(
HIREDIS_INCLUDE_DIR
NAMES hiredis/hiredis.h
HINTS ${HIREDIS_ROOT_DIR}
PATH_SUFFIXES include)
find_library(
HIREDIS_LIBRARY
NAMES hiredis
HINTS ${HIREDIS_ROOT_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR})
set(HIREDIS_INCLUDE_DIRS ${HIREDIS_INCLUDE_DIR})
set(HIREDIS_LIBRARIES ${HIREDIS_LIBRARY})
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(
hiredis DEFAULT_MSG HIREDIS_LIBRARY HIREDIS_INCLUDE_DIR)
mark_as_advanced(HIREDIS_LIBRARY HIREDIS_INCLUDE_DIR)
endif()
# Find the intervalset library (https://framagit.org/batsim/intervalset)
#
# Sets the usual variables expected for find_package scripts:
#
# INTERVALSET_INCLUDE_DIR - header location
# INTERVALSET_LIBRARIES - library to link against
# INTERVALSET_FOUND - true if intervalset was found.
find_path(INTERVALSET_INCLUDE_DIR intervalset.hpp)
find_library(INTERVALSET_LIBRARY intervalset)
# Support the REQUIRED and QUIET arguments, and set INTERVALSET_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(intervalset DEFAULT_MSG INTERVALSET_LIBRARY
INTERVALSET_INCLUDE_DIR)
mark_as_advanced(INTERVALSET_LIBRARY INTERVALSET_INCLUDE_DIR)
# File got from redox repo, https://github.com/hmartiro/redox.
# Try to find libev
# Once done, this will define
#
# LIBEV_FOUND - system has libev
# LIBEV_INCLUDE_DIRS - libev include directories
# LIBEV_LIBRARIES - libraries needed to use libev
if(LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES)
set(LIBEV_FIND_QUIETLY TRUE)
else()
find_path(
LIBEV_INCLUDE_DIR
NAMES ev.h
HINTS ${LIBEV_ROOT_DIR}
PATH_SUFFIXES include)
find_library(
LIBEV_LIBRARY
NAME ev
HINTS ${LIBEV_ROOT_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR})
set(LIBEV_INCLUDE_DIRS ${LIBEV_INCLUDE_DIR})
set(LIBEV_LIBRARIES ${LIBEV_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
libev DEFAULT_MSG LIBEV_LIBRARY LIBEV_INCLUDE_DIR)
mark_as_advanced(LIBEV_LIBRARY LIBEV_INCLUDE_DIR)
endif()
# Find the loguru library (https://github.com/emilk/loguru)
#
# Sets the usual variables expected for find_package scripts:
#
# LOGURU_INCLUDE_DIR - header location
# LOGURU_LIBRARIES - libraries needed to use loguru
# LOGURU_FOUND - true if loguru was found.
find_path(LOGURU_INCLUDE_DIR loguru.hpp)
find_library(LOGURU_LIBRARIES NAMES loguru libloguru)
# Support the REQUIRED and QUIET arguments, and set LOGURU_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(loguru DEFAULT_MSG LOGURU_INCLUDE_DIR LOGURU_LIBRARIES)
mark_as_advanced(LOGURU_INCLUDE_DIR LOGURU_LIBRARIES)
# Copyright (c) 2011 Milo Yip (miloyip@gmail.com)
# Copyright (c) 2013 Rafal Jeczalik (rjeczalik@gmail.com)
# Distributed under the MIT License (see license.txt file)
# -----------------------------------------------------------------------------------
#
# Finds the rapidjson library
#
# -----------------------------------------------------------------------------------
#
# Variables used by this module, they can change the default behaviour.
# Those variables need to be either set before calling find_package
# or exported as environment variables before running CMake:
#
# RAPIDJSON_INCLUDEDIR - Set custom include path, useful when rapidjson headers are
# outside system paths
# RAPIDJSON_USE_SSE2 - Configure rapidjson to take advantage of SSE2 capabilities
# RAPIDJSON_USE_SSE42 - Configure rapidjson to take advantage of SSE4.2 capabilities
#
# -----------------------------------------------------------------------------------
#
# Variables defined by this module:
#
# RAPIDJSON_FOUND - True if rapidjson was found
# RAPIDJSON_INCLUDE_DIRS - Path to rapidjson include directory
# RAPIDJSON_CXX_FLAGS - Extra C++ flags required for compilation with rapidjson
#
# -----------------------------------------------------------------------------------
#
# Example usage:
#
# set(RAPIDJSON_USE_SSE2 ON)
# set(RAPIDJSON_INCLUDEDIR "/opt/github.com/rjeczalik/rapidjson/include")
#
# find_package(rapidjson REQUIRED)
#
# include_directories("${RAPIDJSON_INCLUDE_DIRS}")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}")
# add_executable(foo foo.cc)
#
# -----------------------------------------------------------------------------------
foreach(opt RAPIDJSON_INCLUDEDIR RAPIDJSON_USE_SSE2 RAPIDJSON_USE_SSE42)
if(${opt} AND DEFINED ENV{${opt}} AND NOT ${opt} STREQUAL "$ENV{${opt}}")
message(WARNING "Conflicting ${opt} values: ignoring environment variable and using CMake cache entry.")
elseif(DEFINED ENV{${opt}} AND NOT ${opt})
set(${opt} "$ENV{${opt}}")
endif()
endforeach()
find_path(
RAPIDJSON_INCLUDE_DIRS
NAMES rapidjson/rapidjson.h
PATHS ${RAPIDJSON_INCLUDEDIR}
DOC "Include directory for the rapidjson library."
)
mark_as_advanced(RAPIDJSON_INCLUDE_DIRS)
if(RAPIDJSON_INCLUDE_DIRS)
set(RAPIDJSON_FOUND TRUE)
endif()
mark_as_advanced(RAPIDJSON_FOUND)
if(RAPIDJSON_USE_SSE42)
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE42")
if(MSVC)
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE4.2")
else()
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse4.2")
endif()
else()
if(RAPIDJSON_USE_SSE2)
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE2")
if(MSVC)
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE2")
else()
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse2")
endif()
endif()
endif()
mark_as_advanced(RAPIDJSON_CXX_FLAGS)
if(RAPIDJSON_FOUND)
if(NOT rapidjson_FIND_QUIETLY)
message(STATUS "Found rapidjson header files in ${RAPIDJSON_INCLUDE_DIRS}")
if(DEFINED RAPIDJSON_CXX_FLAGS)
message(STATUS "Found rapidjson C++ extra compilation flags: ${RAPIDJSON_CXX_FLAGS}")
endif()
endif()
elseif(rapidjson_FIND_REQUIRED)
message(FATAL_ERROR "Could not find rapidjson")
else()
message(STATUS "Optional package rapidjson was not found")
endif()
# Try fo find Redox.
# Once done, this will define:
# REDOX_FOUND
# REDOX_INCLUDE_DIRS
# REDOX_LIBRARIES
find_path(
REDOX_INCLUDE_DIR
NAMES redox.hpp
HINTS ${REDOX_ROOT_DIR})
find_library(
REDOX_LIBRARY
NAMES redox
HINTS ${REDOX_ROOT_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR})
set(REDOX_INCLUDE_DIRS ${REDOX_INCLUDE_DIR})
set(REDOX_LIBRARIES ${REDOX_LIBRARY})
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(
redox DEFAULT_MSG REDOX_LIBRARY REDOX_INCLUDE_DIR)
mark_as_advanced(REDOX_LIBRARY REDOX_INCLUDE_DIR)
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
diff-index --quiet HEAD --
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var} "CLEAN" PARENT_SCOPE)
else()
set(${_var} "DIRTY" PARENT_SCOPE)
endif()
endfunction()
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
......@@ -37,18 +37,13 @@ let
mesonBuildType = "debug";
hardeningDisable = [ "all" ];
dontStrip = true;
# Keep files generated by GCOV, so depending jobs can use them.
postInstall = pkgs.lib.optionalString doCoverage ''
mkdir -p $out/gcno
cp batsched.p/*.gcno $out/gcno/
'';
});
# Batmen integration tests.
test = pkgs.mkShell rec {
shellHook = ''
export PATH="./build:$PATH"
'';
''; # to make batmen executable available in the env
buildInputs = with pythonPackages; [
batsim
batexpe
......
project('batsched', 'cpp',
version: '1.4.0',
license: 'free',
project('batmen', 'cpp',
version: '1.0',
license: 'LGPLv3',
default_options: ['cpp_std=c++11'],
meson_version: '>=0.40.0'
)
......@@ -15,7 +15,7 @@ loguru_dep = dependency('loguru')
intervalset_dep = dependency('intervalset')
gmpxx_dep = dependency('gmpxx')
batsched_deps = [
batmen_deps = [
boost_dep,
rapidjson_dep,
libzmq_dep,
......@@ -67,16 +67,14 @@ src = [
'src/protocol.hpp',
'src/queue.cpp',
'src/queue.hpp',
'src/queueing_theory_waiting_time_estimator.cpp',
'src/queueing_theory_waiting_time_estimator.hpp',
'src/schedule.cpp',
'src/schedule.hpp'
]
include_dir = include_directories('src')
batsched = executable('batsched', src,
batmen = executable('batmen', src,
include_directories: include_dir,
dependencies: batsched_deps,
cpp_args: '-DBATSCHED_VERSION=@0@'.format(meson.project_version()),
dependencies: batmen_deps,
cpp_args: '-DBATMEN_VERSION=@0@'.format(meson.project_version()),
install: true
)
......@@ -45,14 +45,6 @@ void run(Network &n, ISchedulingAlgorithm *algo, SchedulingDecision &d, Workload
*/
#define STR(x) STR_HELPER(x)
/** @def BATSCHED_VERSION
* @brief What batsched --version should return.
*
* It is either set by CMake or set to vUNKNOWN_PLEASE_COMPILE_VIA_CMAKE
**/
#ifndef BATSCHED_VERSION
#define BATSCHED_VERSION vUNKNOWN_PLEASE_COMPILE_VIA_CMAKE
#endif
int main(int argc, char **argv)
{
......@@ -74,7 +66,6 @@ int main(int argc, char **argv)
args::ArgumentParser parser("Custom fork of batsched, a Batsim-compatible scheduler in C++.");
args::HelpFlag flag_help(parser, "help", "Display this help menu", { 'h', "help" });
args::CompletionFlag completion(parser, { "complete" });
args::ValueFlag<double> flag_rjms_delay(parser, "delay",
"Sets the expected time that the RJMS takes to do some things like killing a job", { 'd', "rjms_delay" }, 5.0);
......@@ -97,7 +88,6 @@ int main(int argc, char **argv)
args::ValueFlag<bool> flag_call_make_decisions_on_single_nop(parser, "flag",
"If set to true, make_decisions will be called after single NOP messages.",
{ "call_make_decisions_on_single_nop" }, true);
args::Flag flag_version(parser, "version", "Shows batsched version", { "version" });
try
{
......@@ -125,11 +115,6 @@ int main(int argc, char **argv)
printf("%s", parser.Help().c_str());
return 0;
}
catch (args::Completion &e)
{
printf("%s", e.what());
return 0;
}
catch (args::ParseError &e)
{
printf("%s\n", e.what());
......@@ -141,11 +126,6 @@ int main(int argc, char **argv)
return 1;
}
if (flag_version)
{
printf("%s\n", STR(BATSCHED_VERSION));
return 0;
}
string socket_endpoint = flag_socket_endpoint.Get();
string scheduling_variant = flag_scheduling_variant.Get();
......
#include "queueing_theory_waiting_time_estimator.hpp"
#include "pempek_assert.hpp"
void QueueingTheoryWaitingTimeEstimator::add_submitted_job(const Job *job)
{
_recently_submitted_jobs.push_back(job);
}
void QueueingTheoryWaitingTimeEstimator::add_completed_job(const Job *job)
{
_recently_completed_jobs.push_back(job);
}
void QueueingTheoryWaitingTimeEstimator::remove_old(Rational old_date_thresh)
{
for (auto submit_lit = _recently_submitted_jobs.begin(); submit_lit != _recently_submitted_jobs.end(); )
{
const Job * job = *submit_lit;
if (job->submission_time < old_date_thresh)
submit_lit = _recently_submitted_jobs.erase(submit_lit);
else
break;
}
for (auto complete_lit = _recently_completed_jobs.begin(); complete_lit != _recently_completed_jobs.end(); )
{
const Job * job = *complete_lit;
if (job->completion_time < old_date_thresh)
complete_lit = _recently_completed_jobs.erase(complete_lit);
else
break;
}
}
Rational QueueingTheoryWaitingTimeEstimator::estimate_waiting_time(Rational period_length)
{
PPK_ASSERT_ERROR(period_length > 0);
Rational arrival_rate = _recently_submitted_jobs.size() / period_length;
Rational service_rate = _recently_completed_jobs.size() / period_length;
if (arrival_rate != service_rate && service_rate != 0)
return (1/(service_rate-arrival_rate)) - (1/service_rate);
else
return std::numeric_limits<Rational>::infinity();
}
Rational QueueingTheoryWaitingTimeEstimator::estimate_waiting_time_by_area(Rational period_length, int nb_awake_machines)
{
(void) period_length;
(void) nb_awake_machines;
PPK_ASSERT_ERROR(false, "Not implemented");
return 0;
}
#pragma once
#include <list>
#include "json_workload.hpp"
#include "exact_numbers.hpp"
struct QueueingTheoryWaitingTimeEstimator
{
void add_submitted_job(const Job * job);
void add_completed_job(const Job * job);
void remove_old(Rational old_date_thresh);
Rational estimate_waiting_time(Rational period_length);
Rational estimate_waiting_time_by_area(Rational period_length, int nb_awake_machines);
private:
std::list<const Job *> _recently_submitted_jobs;
std::list<const Job *> _recently_completed_jobs;
};
......@@ -7,7 +7,7 @@ def test_multicore_filler(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v multicore_filler",
schedcmd=f"batmen -v multicore_filler",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -26,7 +26,7 @@ def test_bin_packing(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy --enable-compute-sharing")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v bin_packing --queue_order=desc_size",
schedcmd=f"batmen -v bin_packing --queue_order=desc_size",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -45,7 +45,7 @@ def test_bin_packing_energy(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy --enable-compute-sharing")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v bin_packing_energy --queue_order=desc_size",
schedcmd=f"batmen -v bin_packing_energy --queue_order=desc_size",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......
......@@ -7,7 +7,7 @@ def test_broker_filler(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v multicore_filler --variant_options_filepath test/schedconf/user_description_file.json",
schedcmd=f"batmen -v multicore_filler --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -23,7 +23,7 @@ def test_broker_binpacking(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v bin_packing --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
schedcmd=f"batmen -v bin_packing --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -39,7 +39,7 @@ def test_broker_binpackingNRJ(platform_multiC, workload_multiC):
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_multiC.filename, output_dir, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
schedcmd=f"batmen -v bin_packing_energy --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -55,7 +55,7 @@ def test_routineSimple_binpackingNRJ():
batcmd = gen_batsim_cmd('test/platforms/multicore/toy_pform_taurus_like.xml', 'test/workloads/multicore/empty_workload.json', output_dir, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath test/schedconf/routine_greedy_simple.json",
schedcmd=f"batmen -v bin_packing_energy --queue_order=desc_size --variant_options_filepath test/schedconf/routine_greedy_simple.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment