First release of the solver component

- Added build script
- Fixed merge errors for the makefile
- Extended the makefile header

Change-Id: Icbf2d9f76ab0f13eea70796fef20422ecdb3e342
This commit is contained in:
Geir Horn 2024-01-10 16:26:09 +01:00 committed by Rudi Schlatte
parent e730917516
commit f5cb0bc6f3
5 changed files with 105 additions and 18 deletions

View File

@ -3,26 +3,40 @@
{
"name": "Linux",
"includePath": [
"${default}",
"/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13",
"/home/GHo/Documents/Code/CxxOpts/include",
"/usr/include",
"/home/GHo/Documents/Code/Theron++",
"/home/GHo/Documents/Code/Theron++/Utility",
"/home/GHo/Documents/Code/Theron++/Communication",
"/home/GHo/Documents/Code/Theron++/Communication/AMQ",
"/opt/AMPL/amplapi/include",
"/opt/AMPL/amplapi/include/ampl",
"${workspaceFolder}/**"
],
"defines": [],
"compilerArgs": [
"--std=c++23",
"-I/opt/AMPL/amplapi/include",
"-I/usr/include"
],
"cStandard": "c23",
"cppStandard": "c++23",
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "/usr/bin/g++"
"compilerPath": "/usr/bin/g++",
"compilerArgs": [
"-std=c++23",
"-I/home/GHo/Documents/Code/Theron++",
"-I/home/GHo/Documents/Code/CxxOpts/include",
"-I/opt/AMPL/amplapi/include/ampl"
],
"cppStandard": "c++23",
"compilerPathInCppPropertiesJson": "/usr/bin/g++",
"mergeConfigurations": false,
"configurationProvider": "ms-vscode.makefile-tools",
"browse": {
"path": [
"/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13",
"/home/GHo/Documents/Code/Theron++",
"/home/GHo/Documents/Code/CxxOpts/include",
"/home/GHo/Documents/Code/Theron++/Utility",
"/home/GHo/Documents/Code/Theron++/Communication",
"/home/GHo/Documents/Code/Theron++/Examples"
],
"limitSymbolsToIncludedHeaders": false
}
}
],
"version": 4

39
MakeSolver.sh Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/bash
# ==============================================================================
#
# Solver Component
#
# This script will build the Solver Component on an 'empty' machine with
# minimal installation of the latest Fedora version. The intent is to load
# all dependencies in a constructive way.
#
# Author and Copyright: Geir Horn, University of Oslo
# Contact: Geir.Horn@mn.uio.no
# License: MPL2.0 (https://www.mozilla.org/en-US/MPL/2.0/)
# ==============================================================================
# Installing the development framework for the distribution
dnf --assumeyes group 'Development Tools'
dnf --assumeyes install ccache qpid-proton-cpp* json-devel coin-or-Couenne
# Cloning the open source dependencies
mkdir Externals
cd Externals
git clone https://github.com/jarro2783/cxxopts.git CxxOpts
git clone https://github.com/GeirHo/TheronPlusPlus.git Theron++
cd
# Installing the AMPL library
wget https://portal.ampl.com/external/?url=\
https://portal.ampl.com/dl/amplce/ampl.linux64.tgz
tar --file=ampl.linux64.tgz --extract --directory=Externals/AMPL
cp ampl.lic Externals/AMPL
# Building the solver component
make SolverComponent -e THERON=Externals/Theron++ \
AMPL_INCLUDE=Externals/AMPL/amplapi/include AMPL_LIB=Externals/AMPL/amplapi/lib\
CxxOpts_DIR=Externals/CxxOpts/include

View File

@ -87,7 +87,8 @@ constexpr std::string_view TimePoint = "predictionTime";
// application execution context as published by the Optimiser Controller is
// defined next.
constexpr std::string_view MetricSubscriptions = "ApplicationContext";
constexpr std::string_view MetricSubscriptions
= "eu.nebulouscloud.optimiser.solver.metrics";
// The metric value messages will be published on different topics and to
// check if an inbound message is from a metric value topic, it is necessary
@ -126,7 +127,7 @@ constexpr std::string_view ObjectiveFunctionName = "ObjectiveFunction";
// should follow some standard topic convention.
constexpr std::string_view SLOViolationTopic
= "eu.nebulouscloud.optimiser.slo.violation";
= "eu.nebulouscloud.optimiser.solver.slo";
/*==============================================================================

View File

@ -67,7 +67,8 @@ License: MPL2.0 (https://www.mozilla.org/en-US/MPL/2.0/)
#include "Communication/AMQ/AMQEndpoint.hpp" // The AMP endpoint
#include "Communication/AMQ/AMQjson.hpp" // Transparent JSON-AMQP
// The cxxopts command line options parser
// The cxxopts command line options parser that can be cloned from
// https://github.com/jarro2783/cxxopts
#include "cxxopts.hpp"

View File

@ -5,6 +5,23 @@
# The NebulOuS solver consists of several interacting actors using the AMQ
# interface of the Theron++ framework.
#
# The following packages should be available on Fedora prior to compiling
# the file
#
# ccache # for effcient C++ compilations
# qpid-proton-cpp* # Qpid Proton Active Message Queue protocol API
# json-devel # Niels Lohmann's JSON library
# coin-or-Couenne # The solver to be used by AMPL
#
# In addtition the problem is formuated using A Mathematical Programming
# Language (AMPL) and so it should be installed from
# https://portal.ampl.com/user/ampl/request/amplce/trial/new
#
# There are source code dependencies that should be cloned to local disk
#
# Theron++ # https://github.com/GeirHo/TheronPlusPlus.git
# cxxopts # https://github.com/jarro2783/cxxopts.git
#
# Author and Copyright: Geir Horn, University of Oslo
# Contact: Geir.Horn@mn.uio.no
# License: MPL2.0 (https://www.mozilla.org/en-US/MPL/2.0/)
@ -14,25 +31,40 @@
# Defining compiler and commands
#
CC = g++
CC = ccache g++
#CC = clang++
RM = rm -f
#------------------------------------------------------------------------------
# Paths
#------------------------------------------------------------------------------
#
# The default values of the paths are given here to be overridden by build
# definitions on the command line for creating the component container.
#
# Location of the Theron++ framework relative to this make file and the code
THERON = /home/GHo/Documents/Code/Theron++
THERON ?= /home/GHo/Documents/Code/Theron++
# Location of the AMPL API directory
AMPL_INCLUDE = /opt/AMPL/amplapi/include
AMPL_INCLUDE ?= /opt/AMPL/amplapi/include
# Location of the library directory
AMPL_LIB ?= /opt/AMPL/amplapi/lib
# The solver component uses the CxxOpts class for parsing the command line
# options since it is header only and lighter than the Options library of
# boost, which seems to have lost the most recent C++ features. The CxxOpts
# library can be cloned from https://github.com/jarro2783/cxxopts
CxxOpts_DIR = /home/GHo/Documents/Code/CxxOpts/include
CxxOpts_DIR ?= /home/GHo/Documents/Code/CxxOpts/include
#------------------------------------------------------------------------------
# Options for the compiler and linker
#------------------------------------------------------------------------------
#
# Optimisation -O3 is the highest level of optimisation and should be used
# with production code. -Og is the code optimising and offering debugging
# transparency and should be use while the code is under development
@ -67,7 +99,7 @@ CXXFLAGS = $(GENERAL_OPTIONS) $(INCLUDE_DIRECTORIES) $(DEPENDENCY_FLAGS) \
CFLAGS = $(DEPENDENCY_FLAGS) $(OPTIMISATION_FLAG) $(GENERAL_OPTIONS)
LDFLAGS = -fuse-ld=gold -ggdb -D_DEBUG -pthread -l$(THERON)/Theron++.a \
-lqpid-proton-cpp -l/opt/AMPL/amplapi/lib/libampl.so
-lqpid-proton-cpp -l$(AMPL_LIB)/libampl.so
#------------------------------------------------------------------------------
# Theron library