unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / code / Atom feed
* [PATCH] benchtests: Building benchmarks as static executables
@ 2021-07-30 21:22 H.J. Lu via Libc-alpha
  2021-08-09 13:01 ` Carlos O'Donell via Libc-alpha
  2021-08-09 19:10 ` Noah Goldstein via Libc-alpha
  0 siblings, 2 replies; 7+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-07-30 21:22 UTC (permalink / raw)
  To: libc-alpha

Building benchmarks as static executables:
=========================================

To build benchmarks as static executables, on the build system, run:

  $ make STATIC-BENCHTESTS=yes bench-build

You can copy benchmark executables to another machine and run them
without copying the source nor build directories.
---
 benchtests/Makefile | 26 +++++++++++++++++++-------
 benchtests/README   | 10 ++++++++++
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/benchtests/Makefile b/benchtests/Makefile
index 1530939a8c..4fcd73131a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -110,11 +110,23 @@ else
 bench-malloc := $(filter malloc-%,${BENCHSET})
 endif
 
-$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
-$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
-$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
-$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
-$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
+ifeq (${STATIC-BENCHTESTS},yes)
++link-benchtests = $(+link-static-tests)
+link-libc-benchtests = $(link-libc-static)
+libm-benchtests = $(common-objpfx)math/libm.a
+thread-library-benchtests = $(static-thread-library)
+else
+link-libc-benchtests = $(link-libc)
++link-benchtests = $(+link-tests)
+thread-library-benchtests = $(shared-thread-library)
+libm-benchtests = $(libm)
+endif
+
+$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
+$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
+$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
+$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
+$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
 
 \f
 
@@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
 
 $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
 	$(link-extra-libs-tests) \
-  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
-	$(+link-tests)
+	$(+link-benchtests)
 
 $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
 
diff --git a/benchtests/README b/benchtests/README
index 44736d7e63..4d83a05b4b 100644
--- a/benchtests/README
+++ b/benchtests/README
@@ -62,6 +62,16 @@ otherwise the above command may try to build the benchmark again.  Benchmarks
 that require generated code to be executed during the build are skipped when
 cross-building.
 
+Building benchmarks as static executables:
+=========================================
+
+To build benchmarks as static executables, on the build system, run:
+
+  $ make STATIC-BENCHTESTS=yes bench-build
+
+You can copy benchmark executables to another machine and run them
+without copying the source nor build directories.
+
 Running subsets of benchmarks:
 ==============================
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-07-30 21:22 [PATCH] benchtests: Building benchmarks as static executables H.J. Lu via Libc-alpha
@ 2021-08-09 13:01 ` Carlos O'Donell via Libc-alpha
  2021-08-09 14:18   ` H.J. Lu via Libc-alpha
  2021-08-09 19:10 ` Noah Goldstein via Libc-alpha
  1 sibling, 1 reply; 7+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2021-08-09 13:01 UTC (permalink / raw)
  To: H.J. Lu, libc-alpha

On 7/30/21 5:22 PM, H.J. Lu via Libc-alpha wrote:
> Building benchmarks as static executables:
> =========================================
> 
> To build benchmarks as static executables, on the build system, run:
> 
>   $ make STATIC-BENCHTESTS=yes bench-build
> 
> You can copy benchmark executables to another machine and run them
> without copying the source nor build directories.

Looking forward to a v2.

Fails to build for i686 with binutils 2.35, the README should mention
architecture and minimum binutils required.

Looks good on x86_64 which has has this feature for longer.

> ---
>  benchtests/Makefile | 26 +++++++++++++++++++-------
>  benchtests/README   | 10 ++++++++++
>  2 files changed, 29 insertions(+), 7 deletions(-)
> 
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> index 1530939a8c..4fcd73131a 100644
> --- a/benchtests/Makefile
> +++ b/benchtests/Makefile
> @@ -110,11 +110,23 @@ else
>  bench-malloc := $(filter malloc-%,${BENCHSET})
>  endif
>  
> -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
> -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
> -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
> -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
> -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
> +ifeq (${STATIC-BENCHTESTS},yes)
> ++link-benchtests = $(+link-static-tests)
> +link-libc-benchtests = $(link-libc-static)
> +libm-benchtests = $(common-objpfx)math/libm.a
> +thread-library-benchtests = $(static-thread-library)
> +else
> +link-libc-benchtests = $(link-libc)
> ++link-benchtests = $(+link-tests)
> +thread-library-benchtests = $(shared-thread-library)
> +libm-benchtests = $(libm)
> +endif
> +
> +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
> +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
> +$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
> +$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
> +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
>  
>  \f
>  
> @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
>  
>  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
>  	$(link-extra-libs-tests) \
> -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
> +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
>    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
> -	$(+link-tests)
> +	$(+link-benchtests)
>  
>  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
>  
> diff --git a/benchtests/README b/benchtests/README
> index 44736d7e63..4d83a05b4b 100644
> --- a/benchtests/README
> +++ b/benchtests/README
> @@ -62,6 +62,16 @@ otherwise the above command may try to build the benchmark again.  Benchmarks
>  that require generated code to be executed during the build are skipped when
>  cross-building.
>  
> +Building benchmarks as static executables:
> +=========================================
> +
> +To build benchmarks as static executables, on the build system, run:
> +
> +  $ make STATIC-BENCHTESTS=yes bench-build
> +
> +You can copy benchmark executables to another machine and run them
> +without copying the source nor build directories.
> +
>  Running subsets of benchmarks:
>  ==============================
>  
> 


-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-08-09 13:01 ` Carlos O'Donell via Libc-alpha
@ 2021-08-09 14:18   ` H.J. Lu via Libc-alpha
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-08-09 14:18 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library

On Mon, Aug 9, 2021 at 6:01 AM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 7/30/21 5:22 PM, H.J. Lu via Libc-alpha wrote:
> > Building benchmarks as static executables:
> > =========================================
> >
> > To build benchmarks as static executables, on the build system, run:
> >
> >   $ make STATIC-BENCHTESTS=yes bench-build
> >
> > You can copy benchmark executables to another machine and run them
> > without copying the source nor build directories.
>
> Looking forward to a v2.
>
> Fails to build for i686 with binutils 2.35, the README should mention
> architecture and minimum binutils required.

I sent out the v2 patch with

On i686, there is no multiarch memove in libc.a, don't include multiarch
memove in ifunc-impl-list.c in libc.a.

> Looks good on x86_64 which has has this feature for longer.
>
> > ---
> >  benchtests/Makefile | 26 +++++++++++++++++++-------
> >  benchtests/README   | 10 ++++++++++
> >  2 files changed, 29 insertions(+), 7 deletions(-)
> >
> > diff --git a/benchtests/Makefile b/benchtests/Makefile
> > index 1530939a8c..4fcd73131a 100644
> > --- a/benchtests/Makefile
> > +++ b/benchtests/Makefile
> > @@ -110,11 +110,23 @@ else
> >  bench-malloc := $(filter malloc-%,${BENCHSET})
> >  endif
> >
> > -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
> > -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
> > -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
> > -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
> > -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
> > +ifeq (${STATIC-BENCHTESTS},yes)
> > ++link-benchtests = $(+link-static-tests)
> > +link-libc-benchtests = $(link-libc-static)
> > +libm-benchtests = $(common-objpfx)math/libm.a
> > +thread-library-benchtests = $(static-thread-library)
> > +else
> > +link-libc-benchtests = $(link-libc)
> > ++link-benchtests = $(+link-tests)
> > +thread-library-benchtests = $(shared-thread-library)
> > +libm-benchtests = $(libm)
> > +endif
> > +
> > +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
> > +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
> > +$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
> > +$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
> > +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
> >
> >
> >
> > @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
> >
> >  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
> >       $(link-extra-libs-tests) \
> > -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
> > +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
> >    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
> > -     $(+link-tests)
> > +     $(+link-benchtests)
> >
> >  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
> >
> > diff --git a/benchtests/README b/benchtests/README
> > index 44736d7e63..4d83a05b4b 100644
> > --- a/benchtests/README
> > +++ b/benchtests/README
> > @@ -62,6 +62,16 @@ otherwise the above command may try to build the benchmark again.  Benchmarks
> >  that require generated code to be executed during the build are skipped when
> >  cross-building.
> >
> > +Building benchmarks as static executables:
> > +=========================================
> > +
> > +To build benchmarks as static executables, on the build system, run:
> > +
> > +  $ make STATIC-BENCHTESTS=yes bench-build
> > +
> > +You can copy benchmark executables to another machine and run them
> > +without copying the source nor build directories.
> > +
> >  Running subsets of benchmarks:
> >  ==============================
> >
> >
>
>
> --
> Cheers,
> Carlos.
>

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-07-30 21:22 [PATCH] benchtests: Building benchmarks as static executables H.J. Lu via Libc-alpha
  2021-08-09 13:01 ` Carlos O'Donell via Libc-alpha
@ 2021-08-09 19:10 ` Noah Goldstein via Libc-alpha
  2021-08-09 19:33   ` H.J. Lu via Libc-alpha
  1 sibling, 1 reply; 7+ messages in thread
From: Noah Goldstein via Libc-alpha @ 2021-08-09 19:10 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

On Fri, Jul 30, 2021 at 5:22 PM H.J. Lu via Libc-alpha <
libc-alpha@sourceware.org> wrote:

> Building benchmarks as static executables:
> =========================================
>
> To build benchmarks as static executables, on the build system, run:
>
>   $ make STATIC-BENCHTESTS=yes bench-build
>
>
Any chance you could add a -falign option for this?


> You can copy benchmark executables to another machine and run them
> without copying the source nor build directories.
> ---
>  benchtests/Makefile | 26 +++++++++++++++++++-------
>  benchtests/README   | 10 ++++++++++
>  2 files changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> index 1530939a8c..4fcd73131a 100644
> --- a/benchtests/Makefile
> +++ b/benchtests/Makefile
> @@ -110,11 +110,23 @@ else
>  bench-malloc := $(filter malloc-%,${BENCHSET})
>  endif
>
> -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
> -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
> -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
> -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
> -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
> +ifeq (${STATIC-BENCHTESTS},yes)
> ++link-benchtests = $(+link-static-tests)
> +link-libc-benchtests = $(link-libc-static)
> +libm-benchtests = $(common-objpfx)math/libm.a
> +thread-library-benchtests = $(static-thread-library)
> +else
> +link-libc-benchtests = $(link-libc)
> ++link-benchtests = $(+link-tests)
> +thread-library-benchtests = $(shared-thread-library)
> +libm-benchtests = $(libm)
> +endif
> +
> +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
> +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
> +$(addprefix $(objpfx)bench-,$(bench-pthread)):
> $(thread-library-benchtests)
> +$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
> +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
>
>
>
> @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench)
> $(binaries-benchset) \
>
>  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
>         $(link-extra-libs-tests) \
> -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
> +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
>    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
> -       $(+link-tests)
> +       $(+link-benchtests)
>
>  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
>
> diff --git a/benchtests/README b/benchtests/README
> index 44736d7e63..4d83a05b4b 100644
> --- a/benchtests/README
> +++ b/benchtests/README
> @@ -62,6 +62,16 @@ otherwise the above command may try to build the
> benchmark again.  Benchmarks
>  that require generated code to be executed during the build are skipped
> when
>  cross-building.
>
> +Building benchmarks as static executables:
> +=========================================
> +
> +To build benchmarks as static executables, on the build system, run:
> +
> +  $ make STATIC-BENCHTESTS=yes bench-build
> +
> +You can copy benchmark executables to another machine and run them
> +without copying the source nor build directories.
> +
>  Running subsets of benchmarks:
>  ==============================
>
> --
> 2.31.1
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-08-09 19:10 ` Noah Goldstein via Libc-alpha
@ 2021-08-09 19:33   ` H.J. Lu via Libc-alpha
  2021-08-09 20:07     ` Noah Goldstein via Libc-alpha
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-08-09 19:33 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: GNU C Library

On Mon, Aug 9, 2021 at 12:10 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
>
>
> On Fri, Jul 30, 2021 at 5:22 PM H.J. Lu via Libc-alpha <libc-alpha@sourceware.org> wrote:
>>
>> Building benchmarks as static executables:
>> =========================================
>>
>> To build benchmarks as static executables, on the build system, run:
>>
>>   $ make STATIC-BENCHTESTS=yes bench-build
>>
>
> Any chance you could add a -falign option for this?

To build glibc or build a specific bench test?

>>
>> You can copy benchmark executables to another machine and run them
>> without copying the source nor build directories.
>> ---
>>  benchtests/Makefile | 26 +++++++++++++++++++-------
>>  benchtests/README   | 10 ++++++++++
>>  2 files changed, 29 insertions(+), 7 deletions(-)
>>
>> diff --git a/benchtests/Makefile b/benchtests/Makefile
>> index 1530939a8c..4fcd73131a 100644
>> --- a/benchtests/Makefile
>> +++ b/benchtests/Makefile
>> @@ -110,11 +110,23 @@ else
>>  bench-malloc := $(filter malloc-%,${BENCHSET})
>>  endif
>>
>> -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
>> -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
>> -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
>> -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
>> -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
>> +ifeq (${STATIC-BENCHTESTS},yes)
>> ++link-benchtests = $(+link-static-tests)
>> +link-libc-benchtests = $(link-libc-static)
>> +libm-benchtests = $(common-objpfx)math/libm.a
>> +thread-library-benchtests = $(static-thread-library)
>> +else
>> +link-libc-benchtests = $(link-libc)
>> ++link-benchtests = $(+link-tests)
>> +thread-library-benchtests = $(shared-thread-library)
>> +libm-benchtests = $(libm)
>> +endif
>> +
>> +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
>> +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
>> +$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
>> +$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
>> +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
>>
>>
>>
>> @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
>>
>>  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
>>         $(link-extra-libs-tests) \
>> -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
>> +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
>>    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
>> -       $(+link-tests)
>> +       $(+link-benchtests)
>>
>>  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
>>
>> diff --git a/benchtests/README b/benchtests/README
>> index 44736d7e63..4d83a05b4b 100644
>> --- a/benchtests/README
>> +++ b/benchtests/README
>> @@ -62,6 +62,16 @@ otherwise the above command may try to build the benchmark again.  Benchmarks
>>  that require generated code to be executed during the build are skipped when
>>  cross-building.
>>
>> +Building benchmarks as static executables:
>> +=========================================
>> +
>> +To build benchmarks as static executables, on the build system, run:
>> +
>> +  $ make STATIC-BENCHTESTS=yes bench-build
>> +
>> +You can copy benchmark executables to another machine and run them
>> +without copying the source nor build directories.
>> +
>>  Running subsets of benchmarks:
>>  ==============================
>>
>> --
>> 2.31.1
>>


-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-08-09 19:33   ` H.J. Lu via Libc-alpha
@ 2021-08-09 20:07     ` Noah Goldstein via Libc-alpha
  2021-08-09 20:29       ` H.J. Lu via Libc-alpha
  0 siblings, 1 reply; 7+ messages in thread
From: Noah Goldstein via Libc-alpha @ 2021-08-09 20:07 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

On Mon, Aug 9, 2021 at 3:34 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> On Mon, Aug 9, 2021 at 12:10 PM Noah Goldstein <goldstein.w.n@gmail.com>
> wrote:
> >
> >
> >
> > On Fri, Jul 30, 2021 at 5:22 PM H.J. Lu via Libc-alpha <
> libc-alpha@sourceware.org> wrote:
> >>
> >> Building benchmarks as static executables:
> >> =========================================
> >>
> >> To build benchmarks as static executables, on the build system, run:
> >>
> >>   $ make STATIC-BENCHTESTS=yes bench-build
> >>
> >
> > Any chance you could add a -falign option for this?
>
> To build glibc or build a specific bench test?
>

I think the functions being benchmarked are the important ones so
if that's what you mean by a specific bench test then that should be
good. The entire build would be fine as well imho.


>
> >>
> >> You can copy benchmark executables to another machine and run them
> >> without copying the source nor build directories.
> >> ---
> >>  benchtests/Makefile | 26 +++++++++++++++++++-------
> >>  benchtests/README   | 10 ++++++++++
> >>  2 files changed, 29 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/benchtests/Makefile b/benchtests/Makefile
> >> index 1530939a8c..4fcd73131a 100644
> >> --- a/benchtests/Makefile
> >> +++ b/benchtests/Makefile
> >> @@ -110,11 +110,23 @@ else
> >>  bench-malloc := $(filter malloc-%,${BENCHSET})
> >>  endif
> >>
> >> -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
> >> -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
> >> -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
> >> -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
> >> -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
> >> +ifeq (${STATIC-BENCHTESTS},yes)
> >> ++link-benchtests = $(+link-static-tests)
> >> +link-libc-benchtests = $(link-libc-static)
> >> +libm-benchtests = $(common-objpfx)math/libm.a
> >> +thread-library-benchtests = $(static-thread-library)
> >> +else
> >> +link-libc-benchtests = $(link-libc)
> >> ++link-benchtests = $(+link-tests)
> >> +thread-library-benchtests = $(shared-thread-library)
> >> +libm-benchtests = $(libm)
> >> +endif
> >> +
> >> +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
> >> +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
> >> +$(addprefix $(objpfx)bench-,$(bench-pthread)):
> $(thread-library-benchtests)
> >> +$(addprefix $(objpfx)bench-,$(bench-malloc)):
> $(thread-library-benchtests)
> >> +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
> >>
> >>
> >>
> >> @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type)
> $(binaries-bench) $(binaries-benchset) \
> >>
> >>  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
> >>         $(link-extra-libs-tests) \
> >> -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
> >> +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
> >>    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
> >> -       $(+link-tests)
> >> +       $(+link-benchtests)
> >>
> >>  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
> >>
> >> diff --git a/benchtests/README b/benchtests/README
> >> index 44736d7e63..4d83a05b4b 100644
> >> --- a/benchtests/README
> >> +++ b/benchtests/README
> >> @@ -62,6 +62,16 @@ otherwise the above command may try to build the
> benchmark again.  Benchmarks
> >>  that require generated code to be executed during the build are
> skipped when
> >>  cross-building.
> >>
> >> +Building benchmarks as static executables:
> >> +=========================================
> >> +
> >> +To build benchmarks as static executables, on the build system, run:
> >> +
> >> +  $ make STATIC-BENCHTESTS=yes bench-build
> >> +
> >> +You can copy benchmark executables to another machine and run them
> >> +without copying the source nor build directories.
> >> +
> >>  Running subsets of benchmarks:
> >>  ==============================
> >>
> >> --
> >> 2.31.1
> >>
>
>
> --
> H.J.
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] benchtests: Building benchmarks as static executables
  2021-08-09 20:07     ` Noah Goldstein via Libc-alpha
@ 2021-08-09 20:29       ` H.J. Lu via Libc-alpha
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-08-09 20:29 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: GNU C Library

On Mon, Aug 9, 2021 at 1:07 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
>
>
> On Mon, Aug 9, 2021 at 3:34 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> On Mon, Aug 9, 2021 at 12:10 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>> >
>> >
>> >
>> > On Fri, Jul 30, 2021 at 5:22 PM H.J. Lu via Libc-alpha <libc-alpha@sourceware.org> wrote:
>> >>
>> >> Building benchmarks as static executables:
>> >> =========================================
>> >>
>> >> To build benchmarks as static executables, on the build system, run:
>> >>
>> >>   $ make STATIC-BENCHTESTS=yes bench-build
>> >>
>> >
>> > Any chance you could add a -falign option for this?
>>
>> To build glibc or build a specific bench test?
>
>
> I think the functions being benchmarked are the important ones so
> if that's what you mean by a specific bench test then that should be
> good. The entire build would be fine as well imho.

I do

 $ BUILD_CC="gcc" CC="gcc" CXX="g++" CFLAGS="-O2 -g -ffoobar" .../configure

to pass -ffoobar to glibc build.

>
>>
>>
>> >>
>> >> You can copy benchmark executables to another machine and run them
>> >> without copying the source nor build directories.
>> >> ---
>> >>  benchtests/Makefile | 26 +++++++++++++++++++-------
>> >>  benchtests/README   | 10 ++++++++++
>> >>  2 files changed, 29 insertions(+), 7 deletions(-)
>> >>
>> >> diff --git a/benchtests/Makefile b/benchtests/Makefile
>> >> index 1530939a8c..4fcd73131a 100644
>> >> --- a/benchtests/Makefile
>> >> +++ b/benchtests/Makefile
>> >> @@ -110,11 +110,23 @@ else
>> >>  bench-malloc := $(filter malloc-%,${BENCHSET})
>> >>  endif
>> >>
>> >> -$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
>> >> -$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
>> >> -$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
>> >> -$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
>> >> -$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
>> >> +ifeq (${STATIC-BENCHTESTS},yes)
>> >> ++link-benchtests = $(+link-static-tests)
>> >> +link-libc-benchtests = $(link-libc-static)
>> >> +libm-benchtests = $(common-objpfx)math/libm.a
>> >> +thread-library-benchtests = $(static-thread-library)
>> >> +else
>> >> +link-libc-benchtests = $(link-libc)
>> >> ++link-benchtests = $(+link-tests)
>> >> +thread-library-benchtests = $(shared-thread-library)
>> >> +libm-benchtests = $(libm)
>> >> +endif
>> >> +
>> >> +$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
>> >> +$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
>> >> +$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
>> >> +$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
>> >> +$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
>> >>
>> >>
>> >>
>> >> @@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
>> >>
>> >>  $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
>> >>         $(link-extra-libs-tests) \
>> >> -  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
>> >> +  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
>> >>    $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
>> >> -       $(+link-tests)
>> >> +       $(+link-benchtests)
>> >>
>> >>  $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
>> >>
>> >> diff --git a/benchtests/README b/benchtests/README
>> >> index 44736d7e63..4d83a05b4b 100644
>> >> --- a/benchtests/README
>> >> +++ b/benchtests/README
>> >> @@ -62,6 +62,16 @@ otherwise the above command may try to build the benchmark again.  Benchmarks
>> >>  that require generated code to be executed during the build are skipped when
>> >>  cross-building.
>> >>
>> >> +Building benchmarks as static executables:
>> >> +=========================================
>> >> +
>> >> +To build benchmarks as static executables, on the build system, run:
>> >> +
>> >> +  $ make STATIC-BENCHTESTS=yes bench-build
>> >> +
>> >> +You can copy benchmark executables to another machine and run them
>> >> +without copying the source nor build directories.
>> >> +
>> >>  Running subsets of benchmarks:
>> >>  ==============================
>> >>
>> >> --
>> >> 2.31.1
>> >>
>>
>>
>> --
>> H.J.



-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-09 20:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 21:22 [PATCH] benchtests: Building benchmarks as static executables H.J. Lu via Libc-alpha
2021-08-09 13:01 ` Carlos O'Donell via Libc-alpha
2021-08-09 14:18   ` H.J. Lu via Libc-alpha
2021-08-09 19:10 ` Noah Goldstein via Libc-alpha
2021-08-09 19:33   ` H.J. Lu via Libc-alpha
2021-08-09 20:07     ` Noah Goldstein via Libc-alpha
2021-08-09 20:29       ` H.J. Lu via Libc-alpha

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/glibc.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).