From f28817c3bf634e6e87027b14bbd1d146c1dfee7b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 2 Mar 2023 17:58:53 +0100 Subject: [PATCH] Build wxparaver and paraver-kernel from github --- bsc/paraver/default.nix | 71 ++++++++-------- bsc/paraver/dont-expand-colors.patch | 120 +++++++++++++++++++++++++++ bsc/paraver/kernel.nix | 62 +++++++++----- bsc/paraver/release.nix | 74 +++++++++++++++++ overlay.nix | 12 ++- test/ci.nix | 2 +- 6 files changed, 275 insertions(+), 66 deletions(-) create mode 100644 bsc/paraver/dont-expand-colors.patch create mode 100644 bsc/paraver/release.nix diff --git a/bsc/paraver/default.nix b/bsc/paraver/default.nix index 79198420..60141ec9 100644 --- a/bsc/paraver/default.nix +++ b/bsc/paraver/default.nix @@ -1,74 +1,73 @@ { stdenv -, lib -, fetchFromGitHub +, autoreconfHook , boost , libxml2 , xml2 -, fetchurl -, wxGTK32 +, wxGTK30 , autoconf , automake -, openssl # For boost -# Custom patches :) -, enableMouseLabel ? false +, paraverKernel +, openssl +, glibcLocales }: -with lib; - let - wx = wxGTK32; + wx = wxGTK30; in stdenv.mkDerivation rec { pname = "wxparaver"; version = "4.10.6"; - src = fetchurl { - url = "https://ftp.tools.bsc.es/wxparaver/wxparaver-${version}-src.tar.bz2"; - sha256 = "a7L15viCXtQS9vAsdFzCFlUavUzl4Y0yOYmVSCrdWBU="; + src = builtins.fetchGit { + url = "https://github.com/bsc-performance-tools/wxparaver.git"; + rev = "fe55c724ab59a5b0e60718919297bdf95582badb"; # v4.10.6 (missing tag) + ref = "master"; }; - patches = [] - ++ optional (enableMouseLabel) ./mouse-label.patch; + hardeningDisable = [ "all" ]; + # Fix the PARAVER_HOME variable + postPatch = '' + sed -i 's@^PARAVER_HOME=.*$@PARAVER_HOME='$out'@g' docs/wxparaver + sed -i '1aexport LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"' docs/wxparaver + ''; + + dontStrip = true; enableParallelBuilding = true; - # What would we do without the great gamezelda: - # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=wxparaver - postPatch = '' - pushd src/wxparaver - sed -i \ - -e 's|-lparaver-api -lparaver-kernel|-L../../paraver-kernel/src/.libs -L../../paraver-kernel/api/.libs -lparaver-api -lparaver-kernel -lssl -lcrypto -ldl|g' \ - -e '$awxparaver_bin_CXXFLAGS = @CXXFLAGS@ -I../../paraver-kernel -I../../paraver-kernel/api' \ - src/Makefile.am - - sed -i 's| -L$PARAVER_LIBDIR||g' configure.ac - popd - - # Patch shebang as /usr/bin/env is missing in nix - sed -i '1c#!/bin/sh' src/paraver-cfgs/install.sh - ''; - #TODO: Move the sed commands to proper patches (and maybe send them upstream?) - preConfigure = '' - pushd src/wxparaver - autoreconf -i -f - popd + export CFLAGS="-O3" + export CXXFLAGS="-O3" ''; configureFlags = [ "--with-boost=${boost}" "--with-wx-config=${wx}/bin/wx-config" + "--with-paraver=${paraverKernel}" + "--with-openssl=${openssl.dev}" ]; buildInputs = [ + autoreconfHook boost - xml2 libxml2.dev + xml2 wx autoconf automake + paraverKernel openssl.dev + paraverKernel ]; + postInstall = '' + mkdir -p $out/include + mkdir -p $out/lib/paraver-kernel + mkdir -p $out/share/filters-config + cp -p ${paraverKernel}/bin/* $out/bin + # cp -p ${paraverKernel}/include/* $out/include + cp -a ${paraverKernel}/lib/paraver-kernel $out/lib/paraver-kernel + cp -p ${paraverKernel}/share/filters-config/* $out/share/filters-config + ''; } diff --git a/bsc/paraver/dont-expand-colors.patch b/bsc/paraver/dont-expand-colors.patch new file mode 100644 index 00000000..ff45d785 --- /dev/null +++ b/bsc/paraver/dont-expand-colors.patch @@ -0,0 +1,120 @@ +commit c2fa29f7f1bbde86f41417b198610253fff93667 +Author: Rodrigo Arias +Date: Thu Mar 2 13:14:56 2023 +0100 + + Add the PCF option DONT_EXPAND_COLORS + + Allows the user to specify the complete palette in the PCF, preventing + Paraver from expanding the colors. + +diff --git a/api/semanticcolor.cpp b/api/semanticcolor.cpp +index 9f86960..22859eb 100644 +--- a/api/semanticcolor.cpp ++++ b/api/semanticcolor.cpp +@@ -232,8 +232,9 @@ rgb CodeColor::getColor( PRV_UINT32 pos ) const + { + if( pos == 0 && ParaverConfig::getInstance()->getColorsTimelineUseZero() ) + return ParaverConfig::getInstance()->getColorsTimelineColorZero(); +- pos = pos % colors.size(); +- return colors[ pos ]; ++ // Skip the black at 0 ++ pos = pos % (colors.size() - 1); ++ return colors[ pos + 1 ]; + } + + void CodeColor::setColor( PRV_UINT32 whichPos, rgb whichColor ) +@@ -250,6 +251,12 @@ void CodeColor::setColor( PRV_UINT32 whichPos, rgb whichColor ) + colors[ whichPos ] = whichColor; + } + ++void CodeColor::cutAfter( PRV_UINT32 pos ) ++{ ++ if ( pos < colors.size() ) ++ colors.erase( colors.begin() + pos, colors.end() ); ++} ++ + void CodeColor::setCustomColor( TSemanticValue whichValue, rgb color ) + { + customPalette[ whichValue ] = color; +diff --git a/api/semanticcolor.h b/api/semanticcolor.h +index a079556..bddf3d8 100644 +--- a/api/semanticcolor.h ++++ b/api/semanticcolor.h +@@ -98,6 +98,7 @@ class CodeColor: public SemanticColor + + PRV_UINT32 getNumColors() const; + void setColor( PRV_UINT32 pos, rgb color ); ++ void cutAfter( PRV_UINT32 pos ); + void setCustomColor( TSemanticValue whichValue, rgb color ); + bool existCustomColors() const; + const std::map& getCustomPalette() const; +diff --git a/api/trace.cpp b/api/trace.cpp +index b0d2050..ee2ab69 100644 +--- a/api/trace.cpp ++++ b/api/trace.cpp +@@ -461,12 +461,21 @@ void TraceProxy::parsePCF( const string& whichFile ) + + rgb tmpColor; + const std::map< uint32_t, PCFFileParser<>::rgb >& semanticColors = pcfParser.getSemanticColors(); ++ uint32_t maxValue = 0; ++ + for ( auto it : semanticColors ) + { + std::tie( tmpColor.red, tmpColor.green, tmpColor.blue ) = it.second; + myCodeColor.setColor( it.first, tmpColor ); ++ if (it.first > maxValue) ++ maxValue = it.first; + } + ++ // Cut the palette after the highest defined value, so there are no ++ // extra expanded values ++ if ( !pcfParser.expandColors ) ++ myCodeColor.cutAfter(maxValue); ++ + myEventLabels = EventLabels( pcfParser ); + myStateLabels = StateLabels( pcfParser ); + +diff --git a/utils/traceparser/pcffileparser.cpp b/utils/traceparser/pcffileparser.cpp +index 9245955..3a1aecb 100644 +--- a/utils/traceparser/pcffileparser.cpp ++++ b/utils/traceparser/pcffileparser.cpp +@@ -286,6 +286,7 @@ constexpr char PCF_LABEL_SPEED[] = "SPEED"; + constexpr char PCF_LABEL_FLAG_ICONS[] = "FLAG_ICONS"; + constexpr char PCF_LABEL_NUM_OF_STATE_COLORS[] = "NUM_OF_STATE_COLORS"; + constexpr char PCF_LABEL_YMAX_SCALE[] = "YMAX_SCALE"; ++constexpr char PCF_LABEL_DONT_EXPAND_COLORS[] = "DONT_EXPAND_COLORS"; + + template< typename dummyParser = std::nullptr_t > + class DefaultOptionsParser : public PCFFileParser<>::SectionParser<> +@@ -293,12 +294,13 @@ class DefaultOptionsParser : public PCFFileParser<>::SectionParser<> + public: + DefaultOptionsParser( PCFFileParser<> *whichMainParser ) : PCFFileParser<>::SectionParser<>( whichMainParser ) + { +- parameterSetter[ PCF_LABEL_LEVEL ] = [this]( std::string line ) { mainParser->level = line; }; +- parameterSetter[ PCF_LABEL_UNITS ] = [this]( std::string line ) { mainParser->units = line; }; +- parameterSetter[ PCF_LABEL_LOOK_BACK ] = [this]( std::string line ) { mainParser->lookBack = line; }; +- parameterSetter[ PCF_LABEL_SPEED ] = [this]( std::string line ) { mainParser->speed = line; }; +- parameterSetter[ PCF_LABEL_FLAG_ICONS ] = [this]( std::string line ) { mainParser->flagIcons = line; }; +- parameterSetter[ PCF_LABEL_YMAX_SCALE ] = [this]( std::string line ) { mainParser->ymaxScale = line; }; ++ parameterSetter[ PCF_LABEL_LEVEL ] = [this]( std::string line ) { mainParser->level = line; }; ++ parameterSetter[ PCF_LABEL_UNITS ] = [this]( std::string line ) { mainParser->units = line; }; ++ parameterSetter[ PCF_LABEL_LOOK_BACK ] = [this]( std::string line ) { mainParser->lookBack = line; }; ++ parameterSetter[ PCF_LABEL_SPEED ] = [this]( std::string line ) { mainParser->speed = line; }; ++ parameterSetter[ PCF_LABEL_FLAG_ICONS ] = [this]( std::string line ) { mainParser->flagIcons = line; }; ++ parameterSetter[ PCF_LABEL_YMAX_SCALE ] = [this]( std::string line ) { mainParser->ymaxScale = line; }; ++ parameterSetter[ PCF_LABEL_DONT_EXPAND_COLORS ] = [this]( std::string line ) { mainParser->expandColors = false; }; + } + + virtual ~DefaultOptionsParser() = default; +diff --git a/utils/traceparser/pcffileparser.h b/utils/traceparser/pcffileparser.h +index 5fe2634..c12ecc8 100644 +--- a/utils/traceparser/pcffileparser.h ++++ b/utils/traceparser/pcffileparser.h +@@ -100,6 +100,7 @@ class PCFFileParser + void setEventLabel( TEventType eventType, const std::string& label ); + void setEventValues( TEventType eventType, const std::map< TEventValue, std::string >& values ); + void setEventValueLabel( TEventType eventType, TEventValue eventValue, const std::string& label ); ++ bool expandColors = true; + + private: + struct EventTypeData diff --git a/bsc/paraver/kernel.nix b/bsc/paraver/kernel.nix index 0a6c0b9f..5e4d192e 100644 --- a/bsc/paraver/kernel.nix +++ b/bsc/paraver/kernel.nix @@ -1,35 +1,53 @@ -{ stdenv -, fetchFromGitHub +{ + stdenv +, autoreconfHook , boost , libxml2 , xml2 -, fetchurl -, symlinkJoin +, wxGTK30 +, autoconf +, automake }: +let + wx = wxGTK30; +in stdenv.mkDerivation rec { pname = "paraver-kernel"; - version = "4.8.2"; + version = "${src.shortRev}"; - src = fetchurl { - url = "https://ftp.tools.bsc.es/wxparaver/wxparaver-${version}-src.tar.bz2"; - sha256 = "0b8rrhnf7h8j72pj6nrxkrbskgg9b5w60nxi47nxg6275qvfq8hd"; + src = builtins.fetchGit { + url = "https://github.com/bsc-performance-tools/paraver-kernel.git"; + rev = "3f89ec68da8e53ee227c57a2024bf789fa68ba98"; # master (missing tag) + ref = "master"; }; - postUnpack = "sourceRoot=$sourceRoot/src/paraver-kernel"; - - enableParallelBuilding = true; - - preConfigure = '' - configureFlagsArray=( - "--with-boost=${boost}" - ) - ''; - - buildInputs = [ - boost - xml2 - libxml2.dev + patches = [ + # https://github.com/bsc-performance-tools/paraver-kernel/pull/11 + ./dont-expand-colors.patch ]; + hardeningDisable = [ "all" ]; + enableParallelBuilding = true; + + dontStrip = true; + + preConfigure = '' + export CFLAGS="-O3 -DPARALLEL_ENABLED" + export CXXFLAGS="-O3 -DPARALLEL_ENABLED" + ''; + + configureFlags = [ + "--with-boost=${boost}" + "--enable-openmp" + ]; + + buildInputs = [ + autoreconfHook + boost + libxml2.dev + xml2 + autoconf + automake + ]; } diff --git a/bsc/paraver/release.nix b/bsc/paraver/release.nix new file mode 100644 index 00000000..79198420 --- /dev/null +++ b/bsc/paraver/release.nix @@ -0,0 +1,74 @@ +{ + stdenv +, lib +, fetchFromGitHub +, boost +, libxml2 +, xml2 +, fetchurl +, wxGTK32 +, autoconf +, automake +, openssl # For boost +# Custom patches :) +, enableMouseLabel ? false +}: + +with lib; + +let + wx = wxGTK32; +in +stdenv.mkDerivation rec { + pname = "wxparaver"; + version = "4.10.6"; + + src = fetchurl { + url = "https://ftp.tools.bsc.es/wxparaver/wxparaver-${version}-src.tar.bz2"; + sha256 = "a7L15viCXtQS9vAsdFzCFlUavUzl4Y0yOYmVSCrdWBU="; + }; + + patches = [] + ++ optional (enableMouseLabel) ./mouse-label.patch; + + enableParallelBuilding = true; + + # What would we do without the great gamezelda: + # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=wxparaver + postPatch = '' + pushd src/wxparaver + sed -i \ + -e 's|-lparaver-api -lparaver-kernel|-L../../paraver-kernel/src/.libs -L../../paraver-kernel/api/.libs -lparaver-api -lparaver-kernel -lssl -lcrypto -ldl|g' \ + -e '$awxparaver_bin_CXXFLAGS = @CXXFLAGS@ -I../../paraver-kernel -I../../paraver-kernel/api' \ + src/Makefile.am + + sed -i 's| -L$PARAVER_LIBDIR||g' configure.ac + popd + + # Patch shebang as /usr/bin/env is missing in nix + sed -i '1c#!/bin/sh' src/paraver-cfgs/install.sh + ''; + #TODO: Move the sed commands to proper patches (and maybe send them upstream?) + + preConfigure = '' + pushd src/wxparaver + autoreconf -i -f + popd + ''; + + configureFlags = [ + "--with-boost=${boost}" + "--with-wx-config=${wx}/bin/wx-config" + ]; + + buildInputs = [ + boost + xml2 + libxml2.dev + wx + autoconf + automake + openssl.dev + ]; + +} diff --git a/overlay.nix b/overlay.nix index de1b4c1d..3599ecf2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -169,14 +169,12 @@ let # Tracing # ================================================================= - paraver = callPackage ./bsc/paraver/default.nix { }; + paraverKernel = callPackage ./bsc/paraver/kernel.nix { }; + wxparaver = callPackage ./bsc/paraver/default.nix { }; + + # We should maintain these... paraverKernelFast = callPackage ./bsc/paraver/kernel-fast.nix { }; - paraverFast = callPackage ./bsc/paraver/wxparaver-fast.nix { }; - paraverExtra = bsc.paraver.override { enableMouseLabel = true; }; - paraverDebug = bsc.paraver.overrideAttrs (old: { - dontStrip = true; - enableDebugging = true; - }); + wxparaverFast = callPackage ./bsc/paraver/wxparaver-fast.nix { }; extrae = callPackage ./bsc/extrae/default.nix { libdwarf = super.libdwarf_20210528; diff --git a/test/ci.nix b/test/ci.nix index 99efcd21..67349d18 100644 --- a/test/ci.nix +++ b/test/ci.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { # Tools ovni extrae - paraver + wxparaver # Runtimes nanos6 ];