Commit 0af43bad authored by ext-rogers_c's avatar ext-rogers_c
Browse files

Update to latest snapshot of master

parents fd9022ad 7e4be294
cmake_minimum_required (VERSION 3.1)
project (OPAL VERSION 2.5.0)
cmake_minimum_required (VERSION 3.12)
cmake_policy(VERSION 3.12)
project (OPAL VERSION 2021.1.99)
set (PROJECT_BUGREPORT opal@lists.psi.ch)
string (REGEX REPLACE "\\.([0-9])\\." ".0\\1." PACKAGE_VERSION ${PROJECT_VERSION})
......@@ -26,6 +28,13 @@ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ")
set (CMAKE_CXX_FLAGS_RELEASE "-O3")
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELWITHDEBINFO)$")
option (BUILD_FOR_PRODUCTION "Disable all assertion checks; Only use for production" OFF)
else()
option (BUILD_FOR_PRODUCTION "Disable all assertion checks; Only use for production" ON)
endif()
# Resolve all library dependencies
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
......@@ -37,7 +46,7 @@ message (STATUS "The underlying C++ compiler is: ${CMAKE_CXX_COMPILER}")
option (ENABLE_OpenMP "Use hybrid parallelism MPI-OpenMP" OFF)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
......@@ -57,6 +66,7 @@ add_compile_options (-fstrict-aliasing)
# See issue 587 and corresponding merge request 415.
add_compile_options (-fno-aggressive-loop-optimizations)
option (USE_STATIC_LIBRARIES "Link with static libraries if available" ON)
if (BUILD_OPAL_PYTHON)
SET(USE_STATIC_LIBRARIES OFF)
find_package (Python COMPONENTS Development REQUIRED)
......@@ -69,7 +79,7 @@ else ()
endif ()
if (NOT USE_STATIC_LIBRARIES)
if (NOT ${USE_STATIC_LIBRARIES})
add_compile_options (-fPIE -fPIC)
add_link_options (-pie)
else ()
......@@ -106,6 +116,12 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
endif ()
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
# An error in Trilinos/12.18.1 causes
# -Waggressive-loop-optimizations with -O3 optimization.
# See issue 587 and corresponding merge request 415.
# Clang does not support this flag!
add_compile_options (-fno-aggressive-loop-optimizations)
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "4.7.3")
message (FATAL_ERROR "To build OPAL you need GCC version 4.7.3 or greater")
endif ()
......@@ -116,6 +132,11 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_link_options (-fopenmp)
endif ()
# Enables extra error checking in the form of precondition assertion, such
# as bounds checking and null pointer checks when dereferencing smart pointers
if (NOT ${BUILD_FOR_PRODUCTION})
add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)
endif()
else ()
message (STATUS "Unknown C++ compiler. Please use the GNU or Intel compiler, if you are having problems.")
endif ()
......@@ -146,8 +167,12 @@ if (USE_STATIC_LIBRARIES)
else ()
set (HDF5_USE_STATIC_LIBRARIES OFF)
endif ()
set (HDF5_PREFER_PARALLEL ON)
find_package (HDF5 REQUIRED)
message (STATUS "Found HDF5 libraries: ${HDF5_C_LIBRARIES}")
if(UNIX AND NOT APPLE)
set (HDF5_LIBRARIES ${HDF5_LIBRARIES} ${CMAKE_DL_LIBS} rt z)
endif ()
message (STATUS "Found HDF5 libraries: ${HDF5_LIBRARIES}")
find_package (GSL REQUIRED)
message (STATUS "Found gsl libraries: ${GSL_LIBRARIES}")
......@@ -155,15 +180,24 @@ message (STATUS "Found gsl libraries: ${GSL_LIBRARIES}")
set (BOOSTROOT $ENV{BOOST_DIR})
if (USE_STATIC_LIBRARIES)
set (Boost_USE_STATIC_LIBS ON)
else ()
set (Boost_USE_STATIC_LIBS OFF)
endif ()
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME OFF)
set (Boost_REQ chrono filesystem iostreams regex serialization system timer)
set (Boost_LIBRARIES chrono filesystem iostreams regex serialization system timer)
if (BUILD_OPAL_PYTHON)
set (Boost_REQ ${Boost_REQ} python37)
set (Boost_LIBRARIES ${Boost_LIBRARIES} python37)
endif ()
if(UNIX AND NOT APPLE)
##################################################################################################################
# ROGERS HACK
# set (Boost_LIBRARIES ${Boost_LIBRARIES} rt)
endif ()
find_package (Boost 1.66.0
REQUIRED COMPONENTS ${Boost_REQ})
REQUIRED COMPONENTS ${Boost_LIBRARIES})
message (STATUS "Found Boost include dir: ${Boost_INCLUDE_DIR}")
message (STATUS "Found Boost library dir: ${Boost_LIBRARY_DIR}")
message (STATUS "Found Boost libraries: ${Boost_LIBRARIES}")
......@@ -253,6 +287,17 @@ if (NO_FIELD_ASSIGN_OPTIMIZATION)
endif ()
option (ENABLE_DOXYDOC "compile Doxygen documentation" OFF)
if (ENABLE_DOXYDOC)
find_package(Doxygen REQUIRED)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY
)
add_custom_target (doxydoc
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif ()
add_custom_target(always_rebuild ALL
DEPENDS
......
......@@ -38,7 +38,7 @@ PROJECT_NAME = "OPAL (Object Oriented Parallel Accelerator Library)"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "2.5"
PROJECT_NUMBER = "2021.1.99"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
......@@ -764,9 +764,9 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.
INPUT = ./src \
./ippl/src \
./optimizer
INPUT = @CMAKE_SOURCE_DIR@/src \
@CMAKE_SOURCE_DIR@/ippl/src \
@CMAKE_SOURCE_DIR@/optimizer
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
......@@ -786,15 +786,8 @@ INPUT_ENCODING = UTF-8
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
FILE_PATTERNS = *.c \
*.cpp \
*.cc \
*.h \
*.hh \
*.H \
*.f90 \
*.hpp
FILE_PATTERNS = *.c* \
*.h*
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
......
......@@ -6,7 +6,7 @@ set (IPPL_VERSION_NAME "V${IPPL_VERSION_MAJOR}.${IPPL_VERSION_MINOR}")
set (IPPL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if (${BUILD_FOR_PRODUCTION})
add_definitions (-DNOPAssert)
endif ()
......@@ -28,5 +28,4 @@ install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}"
RENAME ${PROJECT_NAME}Config.cmake
)
)
\ No newline at end of file
......@@ -379,6 +379,10 @@ public:
// Operators
Element_t operator()(unsigned int i, unsigned int j) const {
// PAssert and PAssert_EQ are macros. They are defined empty, if we
// compile for production. i and j are unused in this case. The
// following statement suppress the 'unused' warning.
(void)i; (void)j;
PAssert_EQ(i, j);
return T(0.0);
}
......@@ -390,6 +394,7 @@ public:
}
AssignProxy operator()(unsigned int i, unsigned int j) {
(void)i; (void)j;
PAssert_EQ(i, j);
return AssignProxy(AntiSymTenzor<T,1>::Zero, 0);
}
......@@ -401,6 +406,7 @@ public:
}
Element_t operator[](unsigned int i) const {
(void)i;
PAssert (i == 0);
return AntiSymTenzor<T,1>::Zero;
}
......@@ -408,6 +414,7 @@ public:
// These are the same as operator[] but with () instead:
Element_t operator()(unsigned int i) const {
(void)i;
PAssert (i == 0);
return AntiSymTenzor<T,1>::Zero;
}
......
......@@ -2,8 +2,8 @@
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
......@@ -17,7 +17,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -161,7 +161,7 @@ bool DataSource::disconnect(DataConnect *dataconn) {
}
// if we've removed all, we can erase all
if (dataconn == 0 && ConnectionList.size() > 0) {
if (dataconn == 0 && !ConnectionList.empty()) {
//dbgmsg<<"Erasing all " << ConnectionList.size() << " DSO's ..." << endl;
ConnectionList.erase(ConnectionList.begin(), ConnectionList.end());
}
......@@ -217,5 +217,5 @@ void DataSource::interact(const char *str, DataConnect *dataconn) {
/***************************************************************************
* $RCSfile: DataSource.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $
* IPPL_VERSION_ID: $Id: DataSource.cpp,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
***************************************************************************/
* IPPL_VERSION_ID: $Id: DataSource.cpp,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
***************************************************************************/
\ No newline at end of file
......@@ -47,7 +47,7 @@ IpplParticleBaseDataSource::IpplParticleBaseDataSource(const char *nm,
IpplParticleBaseDataSource::~IpplParticleBaseDataSource() {
// disconnect all our currently connected attributes
while (AttribList.size() > 0)
while (!AttribList.empty())
disconnect_attrib(AttribList.front());
// remove ourselves from the list of available IpplParticleBase containers
......
set (_SRCS
CRC.cpp
Communicate.cpp
CommCreator.cpp
CommMPI.cpp
Communicate.cpp
Format.cpp
MessageFunctions.cpp
Formatter.cpp
MsgBuffer.cpp
)
set (_HDRS
CRC.h
CommCreator.h
CommMPI.h
Communicate.h
CRC.h
DataTypes.h
Formatter.h
GlobalComm.hpp
Format.h
GlobalComm.h
Message.hpp
GlobalComm.hpp
Message.h
Message.hpp
MsgBuffer.h
Operations.h
TagMaker.h
Tags.h
......@@ -30,4 +32,4 @@ include_directories (
add_ippl_sources (${_SRCS})
add_ippl_headers (${_HDRS})
install (FILES ${_HDRS} DESTINATION include/Message)
install (FILES ${_HDRS} DESTINATION include/Message)
\ No newline at end of file
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit www.amas.web.psi for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// include files
//
// CommMPI - MPI-specific communications object for use with the
// Ippl framework.
// Allows user to establish id's for available nodes, establish connections,
// and send/receive data.
//
// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Message/CommMPI.h"
#include "Message/Message.h"
#include "Utility/IpplInfo.h"
......@@ -103,7 +97,7 @@ CommMPI::CommMPI(int& argc , char**& argv, int procs, bool mpiinit, MPI_Comm mpi
MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
INFOMSG("Ippl will be initialized with " <<
omp_get_max_threads() << " OMP threads\n");
if ( provided != MPI_THREAD_FUNNELED )
ERRORMSG("CommMPI: Didn't get requested MPI-OpenMP setting.\n");
#else
......@@ -149,7 +143,7 @@ CommMPI::CommMPI(int& argc , char**& argv, int procs, bool mpiinit, MPI_Comm mpi
std::vector<int> child_ready(TotalNodes);
for (i = 0; i < TotalNodes; child_ready[i++] = 0)
;
INFOMSG("CommMPI: Parent process waiting for children ..." << endl);
INFOMSG(level5 << "CommMPI: Parent process waiting for children ..." << endl);
reported = 1; // since the parent is already ready
while (reported < TotalNodes)
{
......@@ -160,7 +154,7 @@ CommMPI::CommMPI(int& argc , char**& argv, int procs, bool mpiinit, MPI_Comm mpi
{
child_ready[rep_host] = 1;
reported++;
INFOMSG("CommMPI: Child " << rep_host << " ready." << endl);
INFOMSG(level5 << "CommMPI: Child " << rep_host << " ready." << endl);
}
else
{
......@@ -171,7 +165,7 @@ CommMPI::CommMPI(int& argc , char**& argv, int procs, bool mpiinit, MPI_Comm mpi
}
//~ delete [] child_ready;
INFOMSG("CommMPI: Initialization complete." << endl);
INFOMSG(level5 << "CommMPI: Initialization complete." << endl);
}
else // this is a child process; get data from pops
......@@ -180,7 +174,7 @@ CommMPI::CommMPI(int& argc , char**& argv, int procs, bool mpiinit, MPI_Comm mpi
ierror = MPI_Get_processor_name(host_name, &result_len);
if (ierror >= 0)
{
INFOMSG("CommMPI: Started job " << myHost << " on host `");
INFOMSG(level5 << "CommMPI: Started job " << myHost << " on host `");
INFOMSG(host_name << "'." << endl);
}
else
......@@ -623,4 +617,4 @@ int CommMPI::raw_probe_receive(char *&data, int &node, int &tag)
MPI_Recv(data, count, MPI_BYTE, node, tag, communicator, &stat);
return count;
}
}
\ No newline at end of file
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
//
// CommMPI - MPI-specific communications object for use with the
// Ippl framework.
// Allows user to establish id's for available nodes, establish connections,
// and send/receive data.
//
// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef COMM_MPI_H
#define COMM_MPI_H
/***************************************************************************
* CommMPI.h - MPI-specific communications object for use with the
* Ippl framework.
* Allows user to establish id's for available nodes, establish connections,
* and send/receive data.
***************************************************************************/
// include files
#include "Message/Communicate.h"
#include <mpi.h>
......@@ -31,7 +33,7 @@ public:
// constructor arguments: command-line args, and number of processes
// to start (if < 0, start the 'default' number, i.e. the number of
// hosts in a MPI virtual machine, the number of nodes in an O2K, etc)
CommMPI(int& argc, char**& argv, int procs = (-1), bool mpiinit = true,
CommMPI(int& argc, char**& argv, int procs = (-1), bool mpiinit = true,
MPI_Comm mpicomm = MPI_COMM_WORLD);
virtual ~CommMPI(void);
......@@ -101,4 +103,4 @@ private:
};
#endif // COMM_MPI_H
#endif // COMM_MPI_H
\ No newline at end of file
......@@ -61,7 +61,7 @@ std::ostream& operator<<(std::ostream& o, const Communicate& c)
// Constructor.
// arguments: command-line args, and number of processes
// to start (if < 0, start the 'default' number, i.e. the number of
// hosts
// hosts
// Note: The base-class constructor does not need the argument info or
// the number of nodes, it just by default sets the number of nodes=1
// Also note: the derived classes should erase Contexts and Processes, and
......@@ -83,7 +83,7 @@ Communicate::Communicate(int, char **, int)
// Destructor. Nothing to do at present.
Communicate::~Communicate(void)
{
// delete the cached messages
SentCache_t::iterator cachei = sentMsgCache.begin();
......@@ -157,7 +157,7 @@ Message* Communicate::myreceive(int&, int&, int)
// Default version of virtual barrier function ... here, does nothing.
void Communicate::mybarrier(void)
{
// just return NULL, since we cannot find a message with this function
return;
......@@ -239,7 +239,7 @@ bool Communicate::send(Message *msg, int node, int tag, bool delmsg)
// 2. In receive queue
Message* Communicate::receive(int& node, int& tag)
{
//Inform dbgmsg("Comm::receive", INFORM_ALL_NODES);
//dbgmsg << "Doing receive from node " << node << ", tag " << tag << endl;
......@@ -299,10 +299,10 @@ Message* Communicate::receive(int& node, int& tag)
// A blocking version of receive.
Message *Communicate::receive_block(int& node, int &tag)
{
// process list of resend requests
process_resend_requests();
......@@ -313,13 +313,13 @@ Message *Communicate::receive_block(int& node, int &tag)
// If we haven't already found a message, check the local messages
//dbgmsg << "Checking for queued message ..." << endl;
Message *msg = find_msg(node, tag);
//dbgmsg << "Found one? " << (msg != 0 ? "yes" : "no") << endl;
// keep checking for remote msgs until we get one
if (myNode() != node)
{
while (msg == 0)
......@@ -362,7 +362,7 @@ Message *Communicate::receive_block(int& node, int &tag)
}
}
}
// If we're on just one node, and we did not find a message, this is
// a big problem.
......@@ -438,7 +438,7 @@ int Communicate::broadcast_others(Message *msg, int tag, bool delmsg)
// else to get here before returning to calling function).
void Communicate::barrier()
{
mybarrier();
//INCIPPLSTAT(incBarriers);
......@@ -864,7 +864,7 @@ void Communicate::remove_single_ok_message(MsgNum_t mnum)
// process list of resend requests
void Communicate::process_resend_requests()
{
if (resendList.size() > 0)
if (!resendList.empty())
{
Inform dbgmsg("***Communicate::process_resend_reqs", INFORM_ALL_NODES);
dbgmsg << "Clearing " << sentOKList.size() << " and resending ";
......@@ -872,7 +872,7 @@ void Communicate::process_resend_requests()
}
// clear out OK messages
while (sentOKList.size() > 0)
while (!sentOKList.empty())
{
MsgNum_t mnum = *(sentOKList.begin());
sentOKList.erase(sentOKList.begin());
......@@ -880,7 +880,7 @@ void Communicate::process_resend_requests()
}
// resend a message, if necessary
while (resendList.size() > 0)
while (!resendList.empty())
{
MsgNum_t mnum = *(resendList.begin());
resendList.erase(resendList.begin());
......@@ -888,7 +888,7 @@ void Communicate::process_resend_requests()
}
// inform other nodes that we've received their messages ok
while (informOKList.size() > 0)
while (!informOKList.empty())
{
int node = (*(informOKList.begin())).first;
MsgNum_t mnum = (*(informOKList.begin())).second;
......@@ -897,11 +897,11 @@ void Communicate::process_resend_requests()
}
// request resends from other nodes
while (requestList.size() > 0)
while (!requestList.empty())
{
int node = (*(requestList.begin())).first;
MsgNum_t mnum = (*(requestList.begin())).second;
requestList.erase(requestList.begin());
request_retransmission(node, mnum);
}
}
}
\ No newline at end of file
//
// Class TerminalStream
// A stream of input tokens.
// The source of tokens is the terminal.
// Class Format
// Format class to allow serializing message objects into plain buffers
// to send directly with mpi calls or similar means
//
// Copyright (c) 2012-2019, Paul Scherrer Institut, Villigen PSI, Switzerland
// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
......@@ -16,33 +16,29 @@
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Parser/TerminalStream.h"
#include "Message/Format.h"
#include <iomanip>
#include <iostream>
Format::Format(Message *msg)
{
items = msg->size();
size = 0;
TerminalStream::TerminalStream(
const char[]
): AbsFileStream("standard input") {
}
TerminalStream::~TerminalStream() {
format_array.resize(2*items);
for (unsigned int i=0; i<items; ++i)
{
Message::MsgItem &msgitem = msg->item(i);
format_array[2*i+0] = msgitem.numElems();
format_array[2*i+1] = msgitem.numBytes();
size += format_array[2*i+1];
}
}