summary refs log tree commit diff
path: root/pkgs/tools/networking/hp2p
diff options
context:
space:
mode:
authorBruno Bzeznik <Bruno.Bzeznik@imag.fr>2021-08-26 11:03:54 +0200
committerBruno Bzeznik <Bruno.Bzeznik@imag.fr>2021-08-26 11:03:54 +0200
commita4127fa9430d4e54fc19acc691660a4bc4c1fbe3 (patch)
treef721dd99a60046d33573282eb152a6212cd12b76 /pkgs/tools/networking/hp2p
parent612a8fa189dd1a9499d1c12d2b0d0bc3cf5b8969 (diff)
downloadnixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar.gz
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar.bz2
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar.lz
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar.xz
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.tar.zst
nixpkgs-a4127fa9430d4e54fc19acc691660a4bc4c1fbe3.zip
hp2p: init at 3.3
Diffstat (limited to 'pkgs/tools/networking/hp2p')
-rw-r--r--pkgs/tools/networking/hp2p/default.nix38
-rw-r--r--pkgs/tools/networking/hp2p/python3.patch120
2 files changed, 158 insertions, 0 deletions
diff --git a/pkgs/tools/networking/hp2p/default.nix b/pkgs/tools/networking/hp2p/default.nix
new file mode 100644
index 00000000000..52f3455ed4d
--- /dev/null
+++ b/pkgs/tools/networking/hp2p/default.nix
@@ -0,0 +1,38 @@
+{ lib, stdenv, fetchFromGitHub, mpi, python3Packages, autoconf, automake } :
+
+stdenv.mkDerivation rec {
+  pname = "hp2p";
+  version = "3.3";
+
+  src = fetchFromGitHub {
+    owner = "cea-hpc";
+    repo = "hp2p";
+    rev = version;
+    sha256 = "0zvlwb941rlp3vrf9yzv7njgpj3mh4671ch7qvxfa4hq2ivd52br";
+  };
+
+  patches = [ ./python3.patch ];
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ autoconf automake python3Packages.wrapPython ];
+  buildInputs = [ mpi ] ++ (with python3Packages; [ python numpy matplotlib plotly mpldatacursor ]) ;
+  pythonPath = (with python3Packages; [ numpy matplotlib plotly mpldatacursor ]) ;
+
+  preConfigure = ''
+    patchShebangs autogen.sh
+    ./autogen.sh
+    export CC=mpicc
+    export CXX=mpic++
+  '';
+
+  postInstall = ''
+    wrapPythonPrograms
+  '';
+
+  meta = with lib; {
+    description = "A MPI based benchmark for network diagnostics";
+    homepage = "https://github.com/cea-hpc/hp2p";
+    platforms = platforms.unix;
+    license = licenses.cecill-c;
+    maintainers = [ maintainers.bzizou ];
+  };
+}
diff --git a/pkgs/tools/networking/hp2p/python3.patch b/pkgs/tools/networking/hp2p/python3.patch
new file mode 100644
index 00000000000..13043d9f09f
--- /dev/null
+++ b/pkgs/tools/networking/hp2p/python3.patch
@@ -0,0 +1,120 @@
+diff -u -r source.orig/src/vizhp2p source/src/vizhp2p
+--- source.orig/src/vizhp2p	1970-01-01 01:00:01.000000000 +0100
++++ source/src/vizhp2p	2021-08-24 10:41:42.926881770 +0200
+@@ -94,25 +94,25 @@
+             with open(hostfile) as fd:
+                 for line in fd:
+                     if line.startswith(motif_rank):
+-                        print line
++                        print(line)
+                         c,v = line[len(motif_rank)+1:-1].split(separator)
+                         nodes[c] = v
+                         
+         # display k worst nodes indices
+-        print "\nTop %d bad mean:" % k
++        print("\nTop %d bad mean:" % k)
+         mean_order = np.argsort(a_mean)
+-        print [nodes[str(c)] for c in mean_order[:k]]
++        print([nodes[str(c)] for c in mean_order[:k]])
+         mean_st = "Top nodes with bad mean:\n"
+         for i in range(0, k, hostname_per_line):
+             mean_st += repr([nodes[str(c)] for c 
+                              in mean_order[i:i + hostname_per_line]]) + "\n"
+ 
+-        print "Top %d bad std:" % k
+-        print [nodes[str(c)] for c in np.argsort(a_std)[-k:][::-1]]
++        print("Top %d bad std:" % k)
++        print([nodes[str(c)] for c in np.argsort(a_std)[-k:][::-1]])
+ 
+-        print "Top %d bad mean/std:" % k
++        print("Top %d bad mean/std:" % k)
+         pen_order = np.argsort(a_mean / a_std)
+-        print [nodes[str(c)] for c in pen_order[:k]]
++        print([nodes[str(c)] for c in pen_order[:k]])
+         pen_st = "Top nodes with bad mean/std:\n"
+         for i in range(0, k, hostname_per_line):
+             pen_st += repr([nodes[str(c)] for c 
+@@ -293,9 +293,9 @@
+ # and 'p' (snapshot) 
+ def onrefresh(event):
+     if event.key == 'r':
+-        print "refreshing...",
++        print("refreshing...", end=' ')
+         loop()
+-        print "ok"
++        print("ok")
+     elif event.key == 'q':
+         exit()
+     elif event.key == 'p':
+@@ -303,9 +303,9 @@
+         fig1.savefig(snapfile)
+         snapfile = outputname + "_snapshot_time.png"
+         fig2.savefig(snapfile)
+-        print 'snapshot saved (%s)' % snapfile
++        print('snapshot saved (%s)' % snapfile)
+     else:
+-        print "The answer to %s is 42." % event.key
++        print("The answer to %s is 42." % event.key)
+ 
+ 
+ if __name__ == "__main__":
+@@ -356,11 +356,11 @@
+         countfile = outputname + ".count.bin"
+ 
+     print("visu_hp2p configuration:")
+-    print("   DATAFILE            : %s"%resfile)
+-    print("   BIN_TIMER_FILE      : %s"%resfile_time)
+-    print("   HOSTFILE            : %s"%hostfile)
+-    print("   Bad nodes to display: %d"%k)
+-    print("   GUI resolution      : %s"%resolution)
++    print(("   DATAFILE            : %s"%resfile))
++    print(("   BIN_TIMER_FILE      : %s"%resfile_time))
++    print(("   HOSTFILE            : %s"%hostfile))
++    print(("   Bad nodes to display: %d"%k))
++    print(("   GUI resolution      : %s"%resolution))
+ 
+     hostname_per_line = 4 # for GUI layout
+     refresh_in_sec = 60
+@@ -377,7 +377,7 @@
+     # wait for resfile
+     while not os.path.exists(resfile) :
+         time.sleep(5)
+-        print "Waiting for input files..."
++        print("Waiting for input files...")
+ 
+     # add callback on key press event
+     cid1 = fig1.canvas.mpl_connect('key_press_event', onrefresh)
+Only in source/src: vizhp2p.bak
+diff -u -r source.orig/src/vizhp2p_html source/src/vizhp2p_html
+--- source.orig/src/vizhp2p_html	1970-01-01 01:00:01.000000000 +0100
++++ source/src/vizhp2p_html	2021-08-24 10:41:54.799946303 +0200
+@@ -118,7 +118,7 @@
+     hostfile = args.hostfile
+     clustername = args.clustername
+     if len(args.OutputName) == 0:
+-        print "No DATAFILE given! Please provide Hp2p output files name !"
++        print("No DATAFILE given! Please provide Hp2p output files name !")
+         exit(0)
+     else:
+         outputname = args.OutputName.split('.')[0]
+@@ -134,13 +134,13 @@
+         else:
+             outfile = args.outfile
+ 
+-    print "%s configuration:"%commandname
+-    print "   DATAFILE            : %s"%resfile
+-    print "   HOSTFILE            : %s"%hostfile
+-    print "   CLUSTER             : %s"%clustername
+-    print "   OUTPUTFILE          : %s"%outfile
++    print("%s configuration:"%commandname)
++    print("   DATAFILE            : %s"%resfile)
++    print("   HOSTFILE            : %s"%hostfile)
++    print("   CLUSTER             : %s"%clustername)
++    print("   OUTPUTFILE          : %s"%outfile)
+     if not os.path.exists(resfile):
+-        print "%s doesn't exist...Exiting"%resfile
++        print("%s doesn't exist...Exiting"%resfile)
+         exit(0)
+ 
+ # Data management
+Only in source/src: vizhp2p_html.bak