diff --git a/Makefile b/Makefile index 604d5b44..d5de6d0c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# $Id: Makefile 1201 2019-08-10 16:51:22Z mueller $ +# $Id: Makefile 1244 2022-06-03 14:06:30Z mueller $ # SPDX-License-Identifier: GPL-3.0-or-later -# Copyright 2011-2019 by Walter F.J. Mueller +# Copyright 2011-2022 by Walter F.J. Mueller # # 'Meta Makefile' for whole retro project # allows to make all synthesis targets @@ -8,6 +8,7 @@ # # Revision History: # Date Rev Version Comment +# 2022-06-03 1244 1.2.13 use 3G memory for njobihtm in vivado targets # 2019-08-07 1201 1.2.12 drop nexys4, add nexys4d # 2019-01-10 1111 1.2.11 drop w11a/arty_bram # 2019-01-02 1101 1.2.10 add tst_{mig,sram}/arty; add w11a/arty @@ -166,13 +167,13 @@ SIM_viv += rtl/sys_gen/w11a/cmoda7/tb default : @echo "No default action defined:" @echo " for VHDL simulation/synthesis use:" - @echo " make -j `njobihtm -m=2G` all" - @echo " make -j `njobihtm -m=1G` all_ise" - @echo " make -j `njobihtm -m=2G` all_viv" - @echo " make -j `njobihtm` all_sim_ise" - @echo " make -j `njobihtm -m=1G` all_syn_ise" - @echo " make -j `njobihtm` all_sim_viv" - @echo " make -j `njobihtm -m=2G` all_syn_viv" + @echo " make -j `njobihtm -n -m=3G` all" + @echo " make -j `njobihtm -n -m=1G` all_ise" + @echo " make -j `njobihtm -n -m=3G` all_viv" + @echo " make -j `njobihtm -n` all_sim_ise" + @echo " make -j `njobihtm -n -m=1G` all_syn_ise" + @echo " make -j `njobihtm -n` all_sim_viv" + @echo " make -j `njobihtm -n -m=3G` all_syn_viv" @echo " make vmfsum" @echo " make imfsum" @echo " make clean" @@ -185,7 +186,7 @@ default : @echo " make clean_sim_viv_tmp" @echo " make clean_syn_viv_tmp" @echo " for tool/documentation generation use:" - @echo " make -j `njobihtm` all_lib" + @echo " make -j `njobihtm -n` all_lib" @echo " make clean_lib" @echo " make all_tcl" @echo " make all_dox" diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 26281b18..d6506c36 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -36,6 +36,8 @@ The full set of tests is only run for tagged releases. - tools changes - ci.yml: define TBW_GHDL_OPTS and suppress IEEE package warnings at t=0ms - **/tbrun.yml: since nexys4 not longer available switch to nexys4d + - tools/bin + - njobihtm: add -n and -h options - tools/dox - w11_(cpp|vhd_all).Doxyfile: for Doxygen V1.9.4 - w11_tcl.Doxyfile: removed, Tcl support removed in Doxygen V1.8.18 diff --git a/doc/INSTALL_simh.md b/doc/INSTALL_simh.md index 467783e2..3a488ba6 100644 --- a/doc/INSTALL_simh.md +++ b/doc/INSTALL_simh.md @@ -44,3 +44,17 @@ See especially Bob Supnik's post Given that situation using version `v3.11-1` as described above is the only prudent option for the time being. + +## Open-SimH relaunch +The post +[Announcing the Open SIMH project](https://groups.io/g/simh/topic/91528716) +announed on 2022-06-03 a re-launch of SimH as FOSS project. +A new repository [open-simh/simh](https://github.com/open-simh/simh#readme) +was setup and provides the SimH code-base under an +[MIT-style licence](https://en.wikipedia.org/wiki/MIT_License), see +[LICENSE.txt](https://github.com/open-simh/simh/blob/master/LICENSE.txt). + +The community will certainly move to open-simh, so best solution is currently +- install SimH from [open-simh/simh](https://github.com/simh/open-simh) +- checkout `v3.11-1` + diff --git a/tools/bin/njobihtm b/tools/bin/njobihtm index 6ad6a44b..a10fec22 100755 --- a/tools/bin/njobihtm +++ b/tools/bin/njobihtm @@ -1,10 +1,11 @@ #!/usr/bin/perl -w -# $Id: njobihtm 1172 2019-06-29 07:27:24Z mueller $ +# $Id: njobihtm 1244 2022-06-03 14:06:30Z mueller $ # SPDX-License-Identifier: GPL-3.0-or-later -# Copyright 2016-2019 by Walter F.J. Mueller +# Copyright 2016-2022 by Walter F.J. Mueller # # Revision History: # Date Rev Version Comment +# 2022-06-03 1244 1.1 add -n and -h options # 2018-12-18 1089 1.0.1 add and use bailout # 2016-10-01 810 1.0 Initial version # @@ -16,7 +17,7 @@ use Getopt::Long; my %opts = (); -GetOptions(\%opts, "verbose", "mem=s" +GetOptions(\%opts, "nohyper", "mem=s", "verbose", "help" ) or bailout("bad command options"); @@ -25,6 +26,11 @@ my $ntpc; my $nkb; my $njob = 1; +if ($opts{help}) { + print_help(); + exit 0; +} + get_cpuinfo(); get_meminfo(); @@ -34,13 +40,14 @@ bailout("failed to obtain cpu or mem size") my $ncore = $ncpu / $ntpc; # number of cores my $nht = $ncpu - $ncore; -$njob = $ncore + int($nht/4); +$njob = $ncore; +$njob += int($nht/4) unless (defined $opts{nohyper}); if ($opts{verbose}) { printf STDERR "#cpus: %d\n", $ncpu; printf STDERR "#thread/cpu: %d\n", $ntpc; printf STDERR "#cores: %d\n", $ncore; - printf STDERR "mem(MB): %d\n", int($nkb/1024); + printf STDERR "#mem(MB): %d\n", int($nkb/1024); printf STDERR "#job (cpus): %d\n", $njob; } @@ -108,3 +115,14 @@ sub bailout { print STDERR "njobihtm-F: $msg\n"; exit 1; } + +#------------------------------------------------------------------------------- + +sub print_help { + print "usage: njobihtm [options]\n"; + print " Options:\n"; + print " -n ignore hyperthreads\n"; + print " -m nn[MG] memory per job as integer followed M or G\n"; + print " -v print system parameters to STDERR\n"; + print " -h this message\n"; +} diff --git a/tools/man/man1/njobihtm.1 b/tools/man/man1/njobihtm.1 index e13fe884..d432c40e 100644 --- a/tools/man/man1/njobihtm.1 +++ b/tools/man/man1/njobihtm.1 @@ -1,11 +1,11 @@ .\" -*- nroff -*- -.\" $Id: njobihtm.1 1237 2022-05-15 07:51:47Z mueller $ +.\" $Id: njobihtm.1 1244 2022-06-03 14:06:30Z mueller $ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" Copyright 2016-2022 by Walter F.J. Mueller .\" .\" ------------------------------------------------------------------ . -.TH NJOBIHTM 1 2016-10-01 "Retro Project" "Retro Project Manual" +.TH NJOBIHTM 1 2022-06-03 "Retro Project" "Retro Project Manual" .\" ------------------------------------------------------------------ .SH NAME njobihtm \- number of jobs considering hyper-threading and memory @@ -13,12 +13,22 @@ njobihtm \- number of jobs considering hyper-threading and memory .SH SYNOPSIS . .SY njobihtm -.OP -v +.OP -h .OP -m nnn[MG] +.OP -v .YS . .\" ------------------------------------------------------------------ .SH DESCRIPTION +The standard system \fBnproc\fP(1) command is often used to determine the +number of parallel jobs, e.g. in a 'make -j'. +It simply returns the total number of available threads. +On many processors with hyper-threading the usage of all hyper-threads is +contra-productive and can lead to a reduction of the throughput. +Experience showed that the optimum throughput is reached when one quarter of +the hyper-threads are used. If jobs require a substantial amount of memory +this can also limit the number of parallel jobs. + \fBnjobihtm\fP determines the number of CPU-intensive jobs based on the number of CPU and memory resources. The 'ihtm' stands for 'intelligent hyper-threading and memory'. The script @@ -26,9 +36,9 @@ hyper-threading and memory'. The script .RS 2 .PD 0 .IP "-" 2 -determines the number of physical cores and the number of threads per core +determines the number of physical cores and the number of threads per core. .IP "-" -assumes that only a quarter of the additional hyper-threads are useful +adds a quarter of the hyper-threads unless the \fB\-n\fP option is given. .IP "-" if \fB-m\fP is given, determines the memory size, assumes that at least one GB should be available for general usage, and limits the number of @@ -36,11 +46,15 @@ jobs accordingly. .PD .RE .PP -The number of jobs is written to STDOUT, and can be used like `njobs`. +The number of jobs is written to \fIstdout\fP, and can be used like +\fBnproc\fP(1). . .\" ------------------------------------------------------------------ .SH OPTIONS . +.\" -- --nohyper --------------------------------- +.IP \fB\-n\fR 9 +ignore hyper-threads, use only physical cores. .\" -- --mem ------------------------------------- .IP \fB\-m\ \fIsize\fR gives the required physical memory per job. @@ -49,7 +63,7 @@ or GB. . .\" -- --verbose --------------------------------- .IP \fB\-v\fP -if given the found system parameters and the reasoning is printed to STDERR. +the found system parameters and the reasoning is printed to \fIstderr\fP. . .\" ------------------------------------------------------------------ .SH EXAMPLES @@ -57,18 +71,32 @@ if given the found system parameters and the reasoning is printed to STDERR. Start \fBmake\fR(1) with a reasonable number of jobs. .IP "\fBnjobihtm -v -m=2G\fR" 4 Determines the number of jobs with 2 GB memory per job. On a system with 4 cores -and hyper-threading and 8 GB installed memory one gets due to the '-v' the -output +and hyper-threading and 32 GB installed memory one gets due to the \fB\-v\fP +the output .EX #cpus: 8 #thread/cpu: 2 #cores: 4 - mem(MB): 7961 + #mem(MB): 31731 #job (cpus): 5 - #job (mem): 3 - 3 + #job (mem): 14 + 5 +.EE +Note that the \fB\-v\fP output goes to \fIstderr\fP, only the answer '5' +to \fIstdout\fP. +.IP "\fBnjobihtm -v -n -m=3G\fR" 4 +Determines the number of jobs with 3 GB memory per job. Only physical cores +are used. On a system with 4 cores and 32 GB installed memory one gets due +to the \fB\-v\fP the output +.EX + #cpus: 8 + #thread/cpu: 2 + #cores: 4 + #mem(MB): 31731 + #job (cpus): 4 + #job (mem): 9 + 4 .EE -Note that the '-v' output goes to STDERR, only the answer '3' to STDOUT. .\" ------------------------------------------------------------------ .SH AUTHOR