gnu: Add j.

  • Open
  • quality assurance status badge
Details
5 participants
  • elaexuotee
  • jgart
  • Leo Prikler
  • Liliana Marie Prikler
  • Maxime Devos
Owner
unassigned
Submitted by
elaexuotee
Severity
normal
Merged with
E
E
elaexuotee wrote on 16 May 2021 12:54
(address . guix-patches@gnu.org)
3LOAUDT0FLL4U.2SOD925YP915T@wilsonb.com
Hey Guix,

This packages up the J programming lanuage. The build scripts that upstream
provides are pretty hostile to package maintainers, so we have to jump through
quite a few hoops to get the build working.

I have had this in my personal, private channel for a while, tweaking it over
time, so I believe it works fairly well in practice. Here are the high-level
design decisions I have made:

1) Provide multiple J versions;

It is extremely common for J users to have multiple versions installed in
parallel since there are often major, breaking changes between
(non-patch-level) releases.

In addition, a very large fraction of J users keep the beta installed as well,
so I have elected to provide this too.

2) Bundle together all variants of the interpreter along with a
wrapper script that selects the most featureful one at runtime;

There are 3 versions of the interpreter, supporting different CPU feature-sets:
vanilla, AVX, AVX2. This package elects to build all these variants and
provides a wrapper script that launches the "most AVX-y" version possible at
runtime.

Essentially, this is trying to make up for upstream's lack of a fat binary.

3) Try to mirror the FHS standard for installation locations;

For the most part, J uses idiosyncratic defaults for where it looks for library
files and the like. This package elects to configure things so files sit in
more standard locations---e.g. runtime scripts sit under .../share/j;
configuration files sit under .../etc/j; etc.

4) Point the J package manager to $HOME/.j/<version>.

J maintains its own mini package repository for "addons", which are simply
officially-supported J scripts. This package sets things up so that these
packages get installed to .j/<version>/addons. In addition, other related
directories are gathered under .j/<version>.


Items on the TODO list:

1) Write an importer and create packages for J addons;

This is currently in progress.

2) Create a something like a jsoftware-union procedure to bundle up J with
user-selectable addons;

This is necessary since the interpreter looks for addons at a specified path.
We probably want to mimick something like texlive and provide both an "all
batteries included" package along with one where users can select which addons
they want.

3) Support more older versions of J.

J is open source starting with j801, so it'd be nice to have packages for the
entire j80x series too. Unfortunately, those use an entirely different set of
build scripts from the current j90x series, so it will require munging-work
similar to what we already have.


Cheers!
L
L
Leo Prikler wrote on 16 May 2021 16:30
8b853d0585505ce29c9afc638b644fa34805e6c0.camel@student.tugraz.at
Hi elaexuotee,

Am Sonntag, den 16.05.2021, 19:54 +0900 schrieb elaexuotee@wilsonb.com:
Toggle quote (5 lines)
> Hey Guix,
>
> This packages up the J programming lanuage. The build scripts that
> upstream provides are pretty hostile to package maintainers, so we
> have to jump through quite a few hoops to get the build working.
Yup, that much is visible from the package description.

Toggle quote (12 lines)
> I have had this in my personal, private channel for a while, tweaking
> it over time, so I believe it works fairly well in practice. Here are
> the high-level design decisions I have made:
>
> 1) Provide multiple J versions;
>
> It is extremely common for J users to have multiple versions
> installed in parallel since there are often major, breaking changes
> between (non-patch-level) releases.
>
> In addition, a very large fraction of J users keep the beta installed
> as well, so I have elected to provide this too.
That should be fine, we provide multiple versions for other packages
where applicable as well. Do note, that we should try to keep the
number limited, though. You may perhaps want to export make-jlib, so
that the user can build their own.

Toggle quote (10 lines)
> 2) Bundle together all variants of the interpreter along with a
> wrapper script that selects the most featureful one at runtime;
>
> There are 3 versions of the interpreter, supporting different CPU
> feature-sets: vanilla, AVX, AVX2. This package elects to build all
> these variants and provides a wrapper script that launches the "most
> AVX-y" version possible at runtime.
>
> Essentially, this is trying to make up for upstream's lack of a fat
> binary.
Are fat binaries the accepted HPC way? I'm not up-to-date to this.

Toggle quote (13 lines)
> 3) Try to mirror the FHS standard for installation locations;
>
> For the most part, J uses idiosyncratic defaults for where it looks
> for library files and the like. This package elects to configure
> things so files sit in more standard locations---e.g. runtime scripts
> sit under .../share/j; configuration files sit under .../etc/j; etc.
>
> 4) Point the J package manager to $HOME/.j/<version>.
>
> J maintains its own mini package repository for "addons", which are
> simply officially-supported J scripts. This package sets things up so
> that these packages get installed to .j/<version>/addons. In
> addition, other related directories are gathered under .j/<version>.
Those should be fine.

Toggle quote (13 lines)
> Items on the TODO list:
>
> 1) Write an importer and create packages for J addons;
>
> This is currently in progress.
>
> 2) Create a something like a jsoftware-union procedure to bundle up J
> with user-selectable addons;
>
> This is necessary since the interpreter looks for addons at a
> specified path. We probably want to mimick something like texlive and
> provide both an "all batteries included" package along with one where
> users can select which addons they want.
Both sound like good ideas, although I'm a little less sure about the
texlive one. Would a meta-package like gnome also be acceptable?

Toggle quote (6 lines)
> 3) Support more older versions of J.
>
> J is open source starting with j801, so it'd be nice to have packages
> for the entire j80x series too. Unfortunately, those use an entirely
> different set of build scripts from the current j90x series, so it
> will require munging-work similar to what we already have.
As above, I'd prefer if it was one procedure and one package pointing
to the latest j80x, assuming all of our added patches can also be
applied to earlier versions.

Toggle quote (19 lines)
> +(define-record-type* <jlib-build-configuration>
> + jlib-build-configuration make-jlib-build-configuration
> + jlib-build-configuration?
> + (builder jlib-build-configuration-builder (default
> "guix.gnu.org"))
> + (version jlib-build-configuration-version (default #f))
> + (revision jlib-build-configuration-revision (default #f))
> + (hash jlib-build-configuration-hash (default #f))
> + (type jlib-build-configuration-type (default 'release))
> + (patches jlib-build-configuration-patches (default '()))
> + (extra-inputs jlib-build-configuration-extra-inputs (default '()))
> + (extra-envars jlib-build-configuration-extra-envars (default
> '())))
> +
> +(define make-jlib
> + (match-lambda
> + (($ <jlib-build-configuration>
> + builder jversion revision hash type patches extra-inputs
> extra-envars)
Please try to use keyword arguments.

Toggle quote (3 lines)
> + (properties `((jversion . ,jversion)
> + (jrevision . ,revision)
> + (jtype . ,type)))
Are those used anywhere? Can jversion and jrevision not be parsed from
(package-version jlib)?

Regards,
Leo
E
E
elaexuotee wrote on 24 May 2021 15:37
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 48463@debbugs.gnu.org)
293L8YPQS4CLB.3VK1B1A36XNAY@wilsonb.com
Thanks for taking a look!

Leo Prikler <leo.prikler@student.tugraz.at> wrote:
Toggle quote (5 lines)
> That should be fine, we provide multiple versions for other packages
> where applicable as well. Do note, that we should try to keep the
> number limited, though. You may perhaps want to export make-jlib, so
> that the user can build their own.

Cool. I like the idea of exporting the build procedures.

Toggle quote (2 lines)
> Are fat binaries the accepted HPC way? I'm not up-to-date to this.

I believe so? Don't quote me on that though. For this particular package the
overhoad is just ~8MB, so I don't think it's much of an issue either way. It
would probably be more of a hassle to split j into a package for each variant.

Toggle quote (3 lines)
> Both sound like good ideas, although I'm a little less sure about the
> texlive one. Would a meta-package like gnome also be acceptable?

A metapackage is certainly practical. The entire set of J addons currently
weighs in at a whopping 50MB. hehe. However, there are about 125 addons in
total, so it simply feels "more correct" to let the user also choose just the
addons they want, which I think would require something like jsoftware-union.

That said, either way, an "all batteries include" package would be good to
have, and since this is way easier than packaging the addons separately, I'll
definitely work on the metapackage first.

Toggle quote (4 lines)
> As above, I'd prefer if it was one procedure and one package pointing
> to the latest j80x, assuming all of our added patches can also be
> applied to earlier versions.

Yeah, that would definitely be ideal.

Unfortunately, it's not so straigthforward. The the "major versions" are the
xxx part of jxxx-y, with large changes between each, e.g. j902 introduced and
non-compatible API change over j901. So, from a pure J user perspective, having
all jxxx versions available is ideal.

However, each version seems to require its own set of build flags and sometimes
version-specific patches (like in the j901 case). We probably don't want to
push those settings out into user manifest specs.

On the other hand, there are already 10 versions from j801 to j903.

Toggle quote (7 lines)
> > +(define make-jlib
> > + (match-lambda
> > + (($ <jlib-build-configuration>
> > + builder jversion revision hash type patches extra-inputs
> > extra-envars)
> Please try to use keyword arguments.

Actually, maybe these "build configuration" records could solve the above
"too many versions" problem. We could offer only the latest J (and J beta?)
packages in the repo, but let (gnu packages jsoftware) export a set of "default
configurations" for old versions to be used with the make-j procedure.

Any particular reason to avoid using records though? Currently, its letting us
share configuration options between j902 and j903 that don't work in j901.
Personally, I thought this felt like a nice declarative, scheme-y way to go,
but my Scheme is still very amateurish. Definitely wanting to rectify any
strange ideas I may have.

Toggle quote (6 lines)
> > + (properties `((jversion . ,jversion)
> > + (jrevision . ,revision)
> > + (jtype . ,type)))
> Are those used anywhere? Can jversion and jrevision not be parsed from
> (package-version jlib)?

The make-j procedure uses them. We'd have to parse out these from both the
version string and package name with a what's essentially the inverse of the
jname procedure. I found it a lot more readable and less hassle to just
propagate this data directly.

However, if there's a particular reason why using properties is problematic,
I'll try to see what I can do.
L
L
Leo Prikler wrote on 24 May 2021 16:39
(address . 48463@debbugs.gnu.org)
5d30160bd2a4592459cd407f99cbd3edadb1db1b.camel@student.tugraz.at
Hi,

Am Montag, den 24.05.2021, 22:37 +0900 schrieb elaexuotee@wilsonb.com:
Toggle quote (8 lines)
> > Are fat binaries the accepted HPC way? I'm not up-to-date to this.
>
> I believe so? Don't quote me on that though. For this particular
> package the
> overhoad is just ~8MB, so I don't think it's much of an issue either
> way. It
> would probably be more of a hassle to split j into a package for each
> variant.
In that case it will probably be fine.

Toggle quote (13 lines)
> > Both sound like good ideas, although I'm a little less sure about
> > the
> > texlive one. Would a meta-package like gnome also be acceptable?
>
> A metapackage is certainly practical. The entire set of J addons
> currently weighs in at a whopping 50MB. hehe. However, there are
> about 125 addons in total, so it simply feels "more correct" to let
> the user also choose just the addons they want, which I think would
> require something like jsoftware-union.
>
> That said, either way, an "all batteries include" package would be
> good to have, and since this is way easier than packaging the addons
> separately, I'll definitely work on the metapackage first.
stuff-union usually implies, that stuff can't just be put into a
profile and expected to work (like texlive), whereas in other cases
(e.g. the gnome metapackage) people can use its parts on their own
provided that they have the right combination (which typically implies
having icons etc.)

Toggle quote (17 lines)
> > As above, I'd prefer if it was one procedure and one package
> > pointing to the latest j80x, assuming all of our added patches can
> > also be applied to earlier versions.
>
> Yeah, that would definitely be ideal.
>
> Unfortunately, it's not so straigthforward. The the "major versions"
> are the xxx part of jxxx-y, with large changes between each, e.g.
> j902 introduced and non-compatible API change over j901. So, from a
> pure J user perspective, having all jxxx versions available is ideal.
>
> However, each version seems to require its own set of build flags and
> sometimes version-specific patches (like in the j901 case). We
> probably don't want to push those settings out into user manifest
> specs.
>
> On the other hand, there are already 10 versions from j801 to j903.
That's less than the number of Rust versions we need just for
bootstrap, but still a few too many in my opinion. Are all of those
still used in production or would it be wiser to to put some of them
into Guix-Past [1]?

Toggle quote (12 lines)
> > > +(define make-jlib
> > > + (match-lambda
> > > + (($ <jlib-build-configuration>
> > > + builder jversion revision hash type patches extra-inputs
> > > extra-envars)
> > Please try to use keyword arguments.
>
> Actually, maybe these "build configuration" records could solve the
> above "too many versions" problem. We could offer only the latest J
> (and J beta?) packages in the repo, but let (gnu packages jsoftware)
> export a set of "default configurations" for old versions to be used
> with the make-j procedure.
I don't think there's much to be gained if we provide packages without
packages.

Toggle quote (6 lines)
> Any particular reason to avoid using records though? Currently, its
> letting us share configuration options between j902 and j903 that
> don't work in j901.
> Personally, I thought this felt like a nice declarative, scheme-y way
> to go, but my Scheme is still very amateurish. Definitely wanting to
> rectify any strange ideas I may have.
Having keyword lists is also nice and declarative, but more
importantly, it lets you call the function as a normal function without
having to worry about constructing some record in a particular way.
The configuration you're using doesn't have a specific setting? Just
override it with your own. It's as simple as calling (append old-
config extra-config).

Toggle quote (13 lines)
> > > + (properties `((jversion . ,jversion)
> > > + (jrevision . ,revision)
> > > + (jtype . ,type)))
> > Are those used anywhere? Can jversion and jrevision not be parsed
> > from (package-version jlib)?
>
> The make-j procedure uses them. We'd have to parse out these from
> both the version string and package name with a what's essentially
> the inverse of the jname procedure. I found it a lot more readable
> and less hassle to just propagate this data directly.
>
> However, if there's a particular reason why using properties is
> problematic, I'll try to see what I can do.
I find this way of mistreating the version field very weird. You're
not adding anything new by doing this and you're not making anything
more secure (I'd argue, that it's less secure, because you could update
the version and forget about the property or vice versa).

First of all, do you even need all this info? `j' is an objectively
bad name for a package. `j-beta' is not better in any way, it only
avoids the user installing a potentially unstable "J" package. (Note,
that we typically use "-next" for that, however). However, this info
is meaningless when hardcoded into a procedure. You can just inherit
from the package that's generated and override the name as needed.

Next, should ijconsole not simply be a package like jlib (both properly
prefixed with jsoftware- of course)? Then you can take whatever
version bits you need from the package version itself.

Regards,
Leo

E
E
elaexuotee wrote on 25 May 2021 05:57
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 48463@debbugs.gnu.org)
27DCD25Y68ZWJ.2HRC4G65PWIA7@wilsonb.com
As always, thanks for the quick turnaround.

Leo Prikler <leo.prikler@student.tugraz.at> wrote:
Toggle quote (6 lines)
> stuff-union usually implies, that stuff can't just be put into a
> profile and expected to work (like texlive), whereas in other cases
> (e.g. the gnome metapackage) people can use its parts on their own
> provided that they have the right combination (which typically implies
> having icons etc.)

Oh, okay. For some reason, I was just imagining "metapackage" to mean "all
batteries included", but your description makes a lot more sense. In this
case, having addons without the J interpreter is pretty useless, so IIUC a
jsoftware-union makes more sense than a metapackage in this case?

Just to be clear, J looks for addons at a path burned into
$store/...-jlib-$version/etc/j/profilex.ijs. Currently, that points to
$HOME/.j/$jversion/addons, but we'll need to change that to a single store
output path that contains the union of all desired addons, hence why I was
thinking the *-union approach is needed.

For now, instead of messing with the union, would it make sense to just create
a (non-public?) jsoftware-addons package that contains all addons and point
jlib at those?

Toggle quote (5 lines)
> That's less than the number of Rust versions we need just for
> bootstrap, but still a few too many in my opinion. Are all of those
> still used in production or would it be wiser to to put some of them
> into Guix-Past [1]?

Oh cool. Guix Past might be a better solution! Thanks for sharing.

I don't have any solid data, since "in production" J is mostly dominated by the
financial sector from what I hear, but just going by my impression from lurking
on the J mailing list, the j80x series (and even earlier non-free versions)
does still have a user base.

Personally, I just want to make these older versions available to the
community but am agnostic about the *how* so will defer to whatever you (and
others) think is best.

Toggle quote (7 lines)
> Having keyword lists is also nice and declarative, but more
> importantly, it lets you call the function as a normal function without
> having to worry about constructing some record in a particular way.
> The configuration you're using doesn't have a specific setting? Just
> override it with your own. It's as simple as calling (append old-
> config extra-config).

Oh! (append old-config extra-config) is exactly the kind of thing I was trying
to achieve; however, I'm not sure I quite grok the usage you are describing.
Something like this?

(define* (proc #:key foo bar) ...)
(define old-config '(#:foo 0))
(define extra-config '(#:bar 1))
(apply proc (append old-config extra-config))

Toggle quote (5 lines)
> I find this way of mistreating the version field very weird. You're
> not adding anything new by doing this and you're not making anything
> more secure (I'd argue, that it's less secure, because you could update
> the version and forget about the property or vice versa).

I agree the version stuff is a bit crappy. It's something that got munged
badly over time and deserves more thought. Here are the issues I'm trying to
solve:

1) The source URLs look like ../j<version>-<type>-<patch> or
../j<version>-<type>, where <type> is either "beta" or "release", and
depending on whether a patch-level exists;
2) The type string ("release" or "beta") is a build setting; and
3) ijconsole installs to something like ../bin/ijconsole-902, without
including the patch-level, like ../bin/ijconsole-902-b.
4) Users should probably be able to easily install the latest J release as
well as J beta concurrently without caring about exactly which version
these are.

Those imply that <version>, <type>, and <patch> are indeed handled separately,
no matter concrete method utilized.

My thinking was that 4 means we want a separate *-beta package, meaning that
the version field should probably just look like "<version>-<patch>".
Additionally, relating back to the above discussion about multiple versions

5) It would be nice to be able to install the latest j901 without having to
know that this corresponds to patch level f, i.e. currently j@901-f.

Toggle quote (4 lines)
> First of all, do you even need all this info? `j' is an objectively bad name
> for a package. `j-beta' is not better in any way, it only avoids the user
> installing a potentially unstable "J" package.

Yeah, "j" is pretty short but it does mirror "r". I'm agnostic about package
name, though. Suggestions welcome.

Toggle quote (2 lines)
> (Note, that we typically use "-next" for that, however).

Thanks for pointing out this convention.

Toggle quote (4 lines)
> However, this info is meaningless when hardcoded into a procedure. You can
> just inherit from the package that's generated and override the name as
> needed.

I see what you mean in a general sense but not quite how to apply it in this
case. I am all ears if you have a simpler, cleaner solution that addresses the
constraints listed above!

Toggle quote (3 lines)
> Next, should ijconsole not simply be a package like jlib (both properly
> prefixed with jsoftware- of course)?

This is effectively what make-j does, no? ijconsole needs to know the path to
jlib, so make-j points it at the correct one and wraps everything up into a
package.


Anyway, thanks again for taking a look!
L
L
Liliana Marie Prikler wrote on 1 Oct 2021 17:06
[PATCH] gnu: add j version 902.
(address . control@debbugs.gnu.org)(name . Philip Kaludercic)(address . philipk@posteo.net)
237300610e48e3e7cc4c256e835b43a800b197f1.camel@gmail.com
merge 48463 43080
thanks

Toggle quote (1 lines)
> Has there been any further progress on including J?
Yes, but that further progress got stalled as well, sadly. Trying to
resume...
L
L
Liliana Marie Prikler wrote on 1 Oct 2021 17:31
Re: gnu: Add j.
(address . elaexuotee@wilsonb.com)(address . 48463@debbugs.gnu.org)
94f4625dcb0479d873cf60449631527e841fd457.camel@gmail.com
Hi,

Am Dienstag, den 25.05.2021, 12:57 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (24 lines)
> As always, thanks for the quick turnaround.
>
> Leo Prikler <leo.prikler@student.tugraz.at> wrote:
> > stuff-union usually implies, that stuff can't just be put into a
> > profile and expected to work (like texlive), whereas in other cases
> > (e.g. the gnome metapackage) people can use its parts on their own
> > provided that they have the right combination (which typically
> > implies having icons etc.)
>
> Oh, okay. For some reason, I was just imagining "metapackage" to
> mean "all batteries included", but your description makes a lot more
> sense. In this case, having addons without the J interpreter is
> pretty useless, so IIUC a jsoftware-union makes more sense than a
> metapackage in this case?
>
> Just to be clear, J looks for addons at a path burned into
> $store/...-jlib-$version/etc/j/profilex.ijs. Currently, that points
> to $HOME/.j/$jversion/addons, but we'll need to change that to a
> single store output path that contains the union of all desired
> addons, hence why I was thinking the *-union approach is needed.
>
> For now, instead of messing with the union, would it make sense to
> just create a (non-public?) jsoftware-addons package that contains
> all addons and point jlib at those?
Are those addons data packages or can they be compiled without needing
jlib? If they're pure data, then you can pack them up and refer them
as you wanted to, if not, you first have to create jlib-minimal without
them, then package up everything and finally do jlib.

Oh, and one thing that was previously ignored is that using XDG
standards for things we can't simply put in the store (like
configuration if it needs that) is preferable to having a ~/.j
directory.

Toggle quote (15 lines)
> > That's less than the number of Rust versions we need just for
> > bootstrap, but still a few too many in my opinion. Are all of
> > those still used in production or would it be wiser to to put some
> > of them into Guix-Past [1]?
>
> Oh cool. Guix Past might be a better solution! Thanks for sharing.
>
> I don't have any solid data, since "in production" J is mostly
> dominated by the financial sector from what I hear, but just going by
> my impression from lurking on the J mailing list, the j80x series
> (and even earlier non-free versions) does still have a user base.
>
> Personally, I just want to make these older versions available to the
> community but am agnostic about the *how* so will defer to whatever
> you (and others) think is best.
People are also still running ancient versions of Debian. Python 2 has
officially reached end of life, yet it is used as well. At some point
we do have to declare software that people are still using as old :)

Toggle quote (17 lines)
> > Having keyword lists is also nice and declarative, but more
> > importantly, it lets you call the function as a normal function
> > without having to worry about constructing some record in a
> > particular way. The configuration you're using doesn't have a
> > specific setting? Just override it with your own. It's as simple
> > as calling (append old-config extra-config).
>
> Oh! (append old-config extra-config) is exactly the kind of thing I
> was trying
> to achieve; however, I'm not sure I quite grok the usage you are
> describing.
> Something like this?
>
> (define* (proc #:key foo bar) ...)
> (define old-config '(#:foo 0))
> (define extra-config '(#:bar 1))
> (apply proc (append old-config extra-config))
Yup.

Toggle quote (26 lines)
> > I find this way of mistreating the version field very
> > weird. You're not adding anything new by doing this and you're not
> > making anything more secure (I'd argue, that it's less secure,
> > because you could update the version and forget about the property
> > or vice versa).
>
> I agree the version stuff is a bit crappy. It's something that got
> munged badly over time and deserves more thought. Here are the
> issues I'm trying to solve:
>
> 1) The source URLs look like ../j<version>-<type>-<patch> or
> ../j<version>-<type>, where <type> is either "beta" or
> "release", and
> depending on whether a patch-level exists;
> 2) The type string ("release" or "beta") is a build setting; and
> 3) ijconsole installs to something like ../bin/ijconsole-902,
> without
> including the patch-level, like ../bin/ijconsole-902-b.
> 4) Users should probably be able to easily install the latest J
> release as
> well as J beta concurrently without caring about exactly which
> version
> these are.
>
> Those imply that <version>, <type>, and <patch> are indeed handled
> separately, no matter concrete method utilized.
Those four issues do call for separate keyword arguments, but they need
not necessarily be reflected in the version string. You can have two
packages with the same version, but different hashes in Guix.

Toggle quote (5 lines)
> My thinking was that 4 means we want a separate *-beta package,
> meaning that the version field should probably just look like
> "<version>-<patch>".
> Additionally, relating back to the above discussion about multiple
> versions
Sounds good, though <version>.<patch> would be equally acceptable.
Your call.

Toggle quote (4 lines)
> 5) It would be nice to be able to install the latest j901 without
> having to
> know that this corresponds to patch level f, i.e. currently
> j@901-f.
I think `guix build j@901' ought to resolve this automatically.

Toggle quote (7 lines)
> > First of all, do you even need all this info? `j' is an
> > objectively bad name
> > for a package. `j-beta' is not better in any way, it only avoids
> > the user installing a potentially unstable "J" package.
>
> Yeah, "j" is pretty short but it does mirror "r". I'm agnostic about
> package name, though. Suggestions welcome.
Fair enough, though this remains a problem for single letter programs
in which others would likely want to claim the letter as well. R has
the benefit of being old and well-known enough, it would probably be
rlang otherwise (not to be confused with erlang).

Toggle quote (11 lines)
> > (Note, that we typically use "-next" for that, however).
>
> Thanks for pointing out this convention.
>
> > However, this info is meaningless when hardcoded into a
> > procedure. You can just inherit from the package that's generated
> > and override the name as needed.
>
> I see what you mean in a general sense but not quite how to apply it
> in this case. I am all ears if you have a simpler, cleaner solution
> that addresses the constraints listed above!
I think the cleaner solution here is to not store those properties in
the package, but still having them as parameters to the make-j function
call.

Toggle quote (6 lines)
> > Next, should ijconsole not simply be a package like jlib (both
> > properly prefixed with jsoftware- of course)?
>
> This is effectively what make-j does, no? ijconsole needs to know the
> path to jlib, so make-j points it at the correct one and wraps
> everything up into a package.
I don't really understand why those needs to be done in two steps
however. ijconsole could already contain the fully functioning j
program. Or partially functioning if we account for addons.

Cheers!
E
E
elaexuotee wrote on 12 Jan 2022 10:47
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 48463@debbugs.gnu.org)
2JQJMV0O718S1.31FZE8GKCTLPF@wilsonb.com
Attachment: file
M
M
Maxime Devos wrote on 12 Jan 2022 12:06
Re: [bug#48463] gnu: Add j.
(address . 48463@debbugs.gnu.org)
54c61a15f0595473496d450b62e340c18ba9c840.camel@telenet.be
elaexuotee--- via Guix-patches via schreef op wo 12-01-2022 om 18:47 [+0900]:
+                  (if ,(target-64bit?)
+                    (parallel
+                      (invoke "env" jplat jbit-avx "./build_libj.sh")
+                      (invoke "env" jplat jbit-avx2
+                              "./build_libj.sh"))))))))

I don't think avx and avx2 are available on aarch64.
Maybe you can use ,(target-x86-64?) instead?

Toggle quote (6 lines)
> + `(#:tests? #f
> [...]
> + (replace 'check
> + (lambda* (#:key tests? #:allow-other-keys)
> + (when tests? [...]))))

I think #:tests? #false should be removed, otherwise this
check phase would never do anything.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYd62ShccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lXXAQDJ0hnY4KkC+VSOpsmlLH7BvCYv
vLZH6H0+lnp1f9I+dAEAnIAdCE/LkEFRh6KAiZed8pVI9yvWZXzCbisBN5mqkws=
=+Nmf
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Jan 2022 12:10
(address . 48463@debbugs.gnu.org)
90704c2259f576a14fb1268219e8c0dc2b3bf289.camel@telenet.be
Hi,
Toggle quote (11 lines)
> +                ;; The jlibrary/dev directory only sometimes exists,
> but needs
> +                ;; to be copied into the ~system directory when it
> does.
> +                (for-each
> +                  (lambda (dev-dir)
> +                    (if (access? dev-dir R_OK)
> +                      (copy-recursively dev-dir
> "test/bin/system/dev")))


Are you testing for file permissions, or for the existence of the file?
If the latter, I'd recommend using 'file-exists?' instead.

Toggle quote (3 lines)
> +                  (if (access? source-dev R_OK)


Likewise.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYd63IxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vtsAQDd+Q3X9aYN4vZKMMMQNuVPxm8f
nnaBo9vhYx8tOPBOIwEA5zqHffCn5ipj+UMoE4dLivjgyGeY+ArbbkY09gitwAc=
=C9FN
-----END PGP SIGNATURE-----


E
E
elaexuotee wrote on 12 Jan 2022 13:07
(name . Maxime Devos)(address . maximedevos@telenet.be)
2P322C327XW0Q.21O5A4IFGMNDI@wilsonb.com
Toggle quote (9 lines)
> > + `(#:tests? #f
> > [...]
> > + (replace 'check
> > + (lambda* (#:key tests? #:allow-other-keys)
> > + (when tests? [...]))))
>
> I think #:tests? #false should be removed, otherwise this
> check phase would never do anything.

Nice catch! Thanks. Disabled tests when tweaking builds and forgot to remove.

Toggle quote (16 lines)
> > +                ;; The jlibrary/dev directory only sometimes exists,
> > but needs
> > +                ;; to be copied into the ~system directory when it
> > does.
> > +                (for-each
> > +                  (lambda (dev-dir)
> > +                    (if (access? dev-dir R_OK)
> > +                      (copy-recursively dev-dir
> > "test/bin/system/dev")))
>
>
> Are you testing for file permissions, or for the existence of the file?
> If the latter, I'd recommend using 'file-exists?' instead.
>
> > +                  (if (access? source-dev R_OK)

Just existence. Thanks for the pointer. Changed.
L
L
Liliana Marie Prikler wrote on 12 Jan 2022 20:55
(address . 48463@debbugs.gnu.org)
72aff035c93f9f91afa54ef5b51c7381b0b02ccb.camel@gmail.com
Hi,

Toggle quote (4 lines)
> +(define-module (gnu packages jsoftware)
> + #:use-module ((guix build utils))
> + [...]

Double bracketing is pointless, use it only when needed.

Toggle quote (20 lines)
> +(define* (make-j #:key
> + (builder "guix.gnu.org")
> + vername
> + revision
> + hash
> + (type 'release)
> + commit
> + (patches '())
> + (extra-inputs '())
> + (extra-envars '()))
> + (package
> + (name (jname "jsoftware-j" type))
> + (version (jversion->string vername revision))
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/jsoftware/jsource")
> + (commit (or commit (jinfo->git-tag vername type
> revision))))
Vername sounds a little weird, make that version-base or something
clearer. Also, the argument #:commit is used in an unclear fashion --
if you were to pass an actual commit hash to it, it'd still be treated
as a release and not be using git-version.

On a related note
Toggle quote (6 lines)
> +(define (jversion->string version revision)
> + "Return a string representation of a J version and (optional)
> revision pair."
> + (let ((postfix (if (not revision) ""
> + (string-append "." revision))))
> + (string-append version postfix)))
should also take commit and revision should probably be dashed. In
that way, when packaging commits between releases we can use
"jrevision.guix-revision" as the complete revision.

In short, I'd add a #:tag argument to override the tag and treat commit
like a let-bound commit.

Toggle quote (8 lines)
> + `(#:modules (((ice-9 ftw) #:select (scandir))
> + ((ice-9 popen) #:select (open-pipe* close-pipe))
> + ((ice-9 regex) #:select (match:substring string-
> match))
> + ((ice-9 threads) #:select (parallel par-for-each))
> + ((srfi srfi-26) #:select (cut))
> + ((srfi srfi-1) #:select (fold))
> + ,@%gnu-build-system-modules)
It's nice that you annotated all those, but note that it probably
wouldn't have been needed. If you notice this list getting longer and
longer as you update, consider dropping the #:selects.

Toggle quote (27 lines)
> + (replace 'build
> + (lambda _
> + (setenv "USE_OPENMP" "1")
> + (setenv "USE_THREAD" "1")
> + (for-each (lambda (var-val) (apply setenv var-val))
> + (quote ,extra-envars))
> + ;; The build scripts assume that PWD is make2.
> + (with-directory-excursion "make2"
> + (let* ((platform ,(if (target-arm?) "raspberry"
> "linux"))
> + (jplat (string-append "jplatform=" platform))
> + (target-bit ,(if (target-64bit?) "64" "32"))
> + (jbit (string-append "j64x=" "j" target-bit))
> + (jbit-avx (string-append jbit "avx"))
> + (jbit-avx2 (string-append jbit "avx2")))
> + (parallel
> + ;; Since jconsole doesn't depend on AVX features,
> we just
> + ;; build it once.
> + (invoke "env" jplat jbit "./build_jconsole.sh")
> + (invoke "env" jplat jbit "./build_libj.sh")
> + (if ,(target-64bit?)
> + (parallel
> + (invoke "env" jplat jbit-avx
> "./build_libj.sh")
> + (invoke "env" jplat jbit-avx2
> + "./build_libj.sh"))))))))
Maxime already made a comment w.r.t. 32bit AVX here, but I think this
would be a prime example to use the CPU tuning that was recently
landed.

Most of the above (except the semantics of the make-j keyword
arguments) are not blockers in my opinion.

Cheers
E
E
elaexuotee wrote on 13 Jan 2022 08:51
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
3MMTDZQJQ8IR6.334ZWY8AD0487@wilsonb.com
Toggle quote (6 lines)
> > +(define-module (gnu packages jsoftware)
> > + #:use-module ((guix build utils))
> > + [...]
>
> Double bracketing is pointless, use it only when needed.

Ah, nice catch. I had a bunch of #:select keys and forgot to kill the parens
when removing.

Toggle quote (25 lines)
> > +(define* (make-j #:key
> > + (builder "guix.gnu.org")
> > + vername
> > + revision
> > + hash
> > + (type 'release)
> > + commit
> > + (patches '())
> > + (extra-inputs '())
> > + (extra-envars '()))
> > + (package
> > + (name (jname "jsoftware-j" type))
> > + (version (jversion->string vername revision))
> > + (source
> > + (origin
> > + (method git-fetch)
> > + (uri (git-reference
> > + (url "https://github.com/jsoftware/jsource")
> > + (commit (or commit (jinfo->git-tag vername type
> > revision))))
> Vername sounds a little weird, make that version-base or something
> clearer. Also, the argument #:commit is used in an unclear fashion --
> if you were to pass an actual commit hash to it, it'd still be treated
> as a release and not be using git-version.

Cool. I had a similar sense, but our ideas are a lot sharper than the ones I
had. This actually prompted me to do some code cleanup, leveraging now-me who
has a bit more Guile experience than past-me. At the very least, variable names
should be more descriptive and consistent, overall.

Toggle quote (14 lines)
> On a related note
> > +(define (jversion->string version revision)
> > + "Return a string representation of a J version and (optional)
> > revision pair."
> > + (let ((postfix (if (not revision) ""
> > + (string-append "." revision))))
> > + (string-append version postfix)))
> should also take commit and revision should probably be dashed. In
> that way, when packaging commits between releases we can use
> "jrevision.guix-revision" as the complete revision.
>
> In short, I'd add a #:tag argument to override the tag and treat commit
> like a let-bound commit.

Done.

Toggle quote (43 lines)
> > + `(#:modules (((ice-9 ftw) #:select (scandir))
> > + ((ice-9 popen) #:select (open-pipe* close-pipe))
> > + ((ice-9 regex) #:select (match:substring string-
> > match))
> > + ((ice-9 threads) #:select (parallel par-for-each))
> > + ((srfi srfi-26) #:select (cut))
> > + ((srfi srfi-1) #:select (fold))
> > + ,@%gnu-build-system-modules)
> It's nice that you annotated all those, but note that it probably
> wouldn't have been needed. If you notice this list getting longer and
> longer as you update, consider dropping the #:selects.
>
> > + (replace 'build
> > + (lambda _
> > + (setenv "USE_OPENMP" "1")
> > + (setenv "USE_THREAD" "1")
> > + (for-each (lambda (var-val) (apply setenv var-val))
> > + (quote ,extra-envars))
> > + ;; The build scripts assume that PWD is make2.
> > + (with-directory-excursion "make2"
> > + (let* ((platform ,(if (target-arm?) "raspberry"
> > "linux"))
> > + (jplat (string-append "jplatform=" platform))
> > + (target-bit ,(if (target-64bit?) "64" "32"))
> > + (jbit (string-append "j64x=" "j" target-bit))
> > + (jbit-avx (string-append jbit "avx"))
> > + (jbit-avx2 (string-append jbit "avx2")))
> > + (parallel
> > + ;; Since jconsole doesn't depend on AVX features,
> > we just
> > + ;; build it once.
> > + (invoke "env" jplat jbit "./build_jconsole.sh")
> > + (invoke "env" jplat jbit "./build_libj.sh")
> > + (if ,(target-64bit?)
> > + (parallel
> > + (invoke "env" jplat jbit-avx
> > "./build_libj.sh")
> > + (invoke "env" jplat jbit-avx2
> > + "./build_libj.sh"))))))))
> Maxime already made a comment w.r.t. 32bit AVX here, but I think this
> would be a prime example to use the CPU tuning that was recently
> landed.

Good idea. Upstream's build scripts condition a *lot* of behaviour on the
j64avx environment variable, so it might not be straightforward, but I will put
this on the to-do list of future improvements.

(Note, the code block quoted here got much simplified in the current patch.)

Toggle quote (3 lines)
> Most of the above (except the semantics of the make-j keyword
> arguments) are not blockers in my opinion.

Cheers!
L
L
Liliana Marie Prikler wrote on 13 Jan 2022 18:51
(address . elaexuotee@wilsonb.com)
62d37956f16c08bc4ce26e44da16dce704ddd0f8.camel@gmail.com
Hi,

Am Donnerstag, dem 13.01.2022 um 16:51 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (33 lines)
> >
> > > +(define* (make-j #:key
> > > +                 (builder "guix.gnu.org")
> > > +                 vername
> > > +                 revision
> > > +                 hash
> > > +                 (type 'release)
> > > +                 commit
> > > +                 (patches '())
> > > +                 (extra-inputs '())
> > > +                 (extra-envars '()))
> > > + (package
> > > +   (name (jname "jsoftware-j" type))
> > > +   (version (jversion->string vername revision))
> > > +   (source
> > > +    (origin
> > > +      (method git-fetch)
> > > +      (uri (git-reference
> > > +            (url "https://github.com/jsoftware/jsource")
> > > +            (commit (or commit (jinfo->git-tag vername type
> > > revision))))
> > Vername sounds a little weird, make that version-base or something
> > clearer.  Also, the argument #:commit is used in an unclear fashion
> > --
> > if you were to pass an actual commit hash to it, it'd still be
> > treated
> > as a release and not be using git-version.
>
> Cool. I had a similar sense, but our ideas are a lot sharper than the
> ones I had. This actually prompted me to do some code cleanup,
> leveraging now-me who has a bit more Guile experience than past-me.
> At the very least, variable names should be more descriptive and
> consistent, overall.
Note, that the current version still ignores commit. I've attached a
proof of concept patch, which fixes that, plus some other minor things,
but it now uses a pair for version. Also it's untested, so treat with
care.


Toggle quote (6 lines)
> Good idea. Upstream's build scripts condition a *lot* of behaviour on
> the j64avx environment variable, so it might not be straightforward,
> but I will put this on the to-do list of future improvements.
>
> (Note, the code block quoted here got much simplified in the current
> patch.)
Reading /proc/cpuinfo is not nice. Please use (guix cpu), which also
provides you the flags that you need.

Cheers
E
E
elaexuotee wrote on 15 Jan 2022 15:05
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
24ZUUMG4QYSHN.2OS7YAMCKREUA@wilsonb.com
Thanks for staying on top of this patch review.

Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
Toggle quote (7 lines)
> Hi,
>
> Note, that the current version still ignores commit. I've attached a
> proof of concept patch, which fixes that, plus some other minor things,
> but it now uses a pair for version. Also it's untested, so treat with
> care.

Oh! I see. You're wanting the version string to have optional REVISION and
COMMIT parts, like `git-version'. That makes a lot of sense.

There was a small issue with `jversion->string' in your patch, which produces
MAJOR-REVISION-COMMIT if no MINOR value is provided. I want to make sure that
users can always have specifications like "jsoftware-j@MAJOR" in their profile
manifest, but guix doesn't treat hyphen as a version separator.

I just changed the logic to always keep a dot after MAJOR, and then use hyphens
after that.

Toggle quote (9 lines)
> > Good idea. Upstream's build scripts condition a *lot* of behaviour on
> > the j64avx environment variable, so it might not be straightforward,
> > but I will put this on the to-do list of future improvements.
> >
> > (Note, the code block quoted here got much simplified in the current
> > patch.)
> Reading /proc/cpuinfo is not nice. Please use (guix cpu), which also
> provides you the flags that you need.

Oh nice. A new, shiny module! This is exactly what I was looking for when
originally writing the script. Updated.
L
L
Liliana Marie Prikler wrote on 15 Jan 2022 16:08
(address . elaexuotee@wilsonb.com)
83aba994536bec60f79900d551d4801c967742bd.camel@gmail.com
Hi,

Am Samstag, dem 15.01.2022 um 23:05 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (22 lines)
> Thanks for staying on top of this patch review.
>
> Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
> > Hi,
> >
> > Note, that the current version still ignores commit.  I've attached
> > a proof of concept patch, which fixes that, plus some other minor
> > things, but it now uses a pair for version.  Also it's untested, so
> > treat with care.
>
> Oh! I see. You're wanting the version string to have optional
> REVISION and COMMIT parts, like `git-version'. That makes a lot of
> sense.
>
> There was a small issue with `jversion->string' in your patch, which
> produces MAJOR-REVISION-COMMIT if no MINOR value is provided. I want
> to make sure that users can always have specifications like
> "jsoftware-j@MAJOR" in their profile manifest, but guix doesn't treat
> hyphen as a version separator.
>
> I just changed the logic to always keep a dot after MAJOR, and then
> use hyphens after that.
I'm not quite sure if I agree with that decision, but you're right that
@MAJOR ought to be supported. How about enforcing that MINOR exists if
REVISION and COMMIT are used and setting it to "0" if there hasn't been
an "a" beta or release yet?

Toggle quote (13 lines)
> >
> > > Good idea. Upstream's build scripts condition a *lot* of
> > > behaviour on he j64avx environment variable, so it might not be
> > > straightforward, but I will put this on the to-do list of future
> > > improvements.
> > >
> > > (Note, the code block quoted here got much simplified in the
> > > current patch.)
> > Reading /proc/cpuinfo is not nice.  Please use (guix cpu), which
> > also provides you the flags that you need.
>
> Oh nice. A new, shiny module! This is exactly what I was looking for
> when originally writing the script. Updated.
LGTM.

Toggle quote (5 lines)
> + (native-inputs `(("clang-toolchain" ,clang-toolchain)))
> + (inputs (cons* `("libedit" ,libedit)
> + `("libomp" ,libomp)
> + `("ijconsole" ,(ijconsole))
> + extra-inputs))
My variant already had these translated to the new style. If you're
not using old style on purpose – and I don't think you do – you might
want to make your life easier by dropping these labels and going with
plain (list)s.

Toggle quote (26 lines)
> + (call-with-output-file "jlibrary/bin/profilex.ijs"
> + (lambda (port)
> + (display
> + (string-join
> + (list
> + "share=. '/share/j',~ ({.~ _2 { I.@:=&'/')
> BINPATH"
> + "system=. share,'/system'"
> + "tools=. share,'/tools'"
> + ;; Upstream defaults to spamming $HOME with
> unhidden
> + ;; userdata directories. Set this to be
> + ;; $HOME/.config/j/<jversion> instead
> + "'jtype jversion'=. (3&{,{.) <;._2 ,&'/'
> 9!:14''"
> + "jversion=. ({.~ i.&'-') jversion"
> + "user=. home,'/.config/j/',jversion"
> + "addons=. user,'/addons'"
> + "break=. user,'/break'"
> + "config=. user,'/config'"
> + "install=. user,'/install'"
> + "snap=. user,'/snap'"
> + "temp=. user,'/temp'"
> + "\n")
> + "\n")
> + port)))
You might want to use an aux-file for that. Name it
jsoftware/profile.ijs if it's just a plain file (which I assume). I
recently pushed a commit towards renpy which replaces a large format
block by fetching an auxiliary file and substitute*, which you can take
as reference if you're unsure. Note that renpy still uses old-style
inputs, so the assoc-ref makes sense in that case; however, you should
be able to also express this pattern in terms of search-input-file
somehow (or otherwise express it as gexp).

Cheers
E
E
elaexuotee wrote on 16 Jan 2022 06:29
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
25Z6NGGGNJYD1.3S7A1QLFX7I9Y@wilsonb.com
Good day.

Toggle quote (7 lines)
> > I just changed the logic to always keep a dot after MAJOR, and then
> > use hyphens after that.
> I'm not quite sure if I agree with that decision, but you're right that
> @MAJOR ought to be supported. How about enforcing that MINOR exists if
> REVISION and COMMIT are used and setting it to "0" if there hasn't been
> an "a" beta or release yet?

Interesting idea. How about just always forcing a MINOR part, setting to "0" if
upstream doesn't have one?

Toggle quote (10 lines)
> > + (native-inputs `(("clang-toolchain" ,clang-toolchain)))
> > + (inputs (cons* `("libedit" ,libedit)
> > + `("libomp" ,libomp)
> > + `("ijconsole" ,(ijconsole))
> > + extra-inputs))
> My variant already had these translated to the new style. If you're
> not using old style on purpose – and I don't think you do – you might
> want to make your life easier by dropping these labels and going with
> plain (list)s.

Yeah, I had trouble getting that to work nicely with the ijconsole input. See
below for more details.

Toggle quote (9 lines)
> You might want to use an aux-file for that. Name it
> jsoftware/profile.ijs if it's just a plain file (which I assume). I
> recently pushed a commit towards renpy which replaces a large format
> block by fetching an auxiliary file and substitute*, which you can take
> as reference if you're unsure. Note that renpy still uses old-style
> inputs, so the assoc-ref makes sense in that case; however, you should
> be able to also express this pattern in terms of search-input-file
> somehow (or otherwise express it as gexp).

Oooh. Neat. That makes adding and testing changes their much nicer.

Note, I wasn't able to find a nice way to get this working together with the
new inputs syntax, since `search-input-files' only searches under input paths
which are directories.

The ijconsole and profilex input are regular files, so it raises a search-error.
One workaronud is to put ijconsole and profilex together under a file-union
input, but I found that almost worse than just using old-style syntax.

If you have a better idea, I am all ears.


Cheers!
L
L
Liliana Marie Prikler wrote on 16 Jan 2022 09:04
(address . elaexuotee@wilsonb.com)
de0a87c99fdbec2475b02fb87cba8e2d17ff26ce.camel@gmail.com
Am Sonntag, dem 16.01.2022 um 14:29 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (12 lines)
> Good day.
>
> >
> > > I just changed the logic to always keep a dot after MAJOR, and
> > > then use hyphens after that.
> > I'm not quite sure if I agree with that decision, but you're right
> > that @MAJOR ought to be supported.  How about enforcing that MINOR
> > exists if REVISION and COMMIT are used and setting it to "0" if
> > there hasn't been an "a" beta or release yet?
>
> Interesting idea. How about just always forcing a MINOR part, setting
> to "0" if upstream doesn't have one?
That'd declare regular releases as MAJOR.0 in the version field, which
I'm not sure if we want that. In the case of random commits I'm less
reserved, as they don't correspond to releases anyway.

Toggle quote (35 lines)
> >
> > > +   (native-inputs `(("clang-toolchain" ,clang-toolchain)))
> > > +   (inputs (cons* `("libedit" ,libedit)
> > > +                  `("libomp" ,libomp)
> > > +                  `("ijconsole" ,(ijconsole))
> > > +                  extra-inputs))
> > My variant already had these translated to the new style.  If
> > you're not using old style on purpose – and I don't think you do –
> > you might want to make your life easier by dropping these labels
> > and going with plain (list)s.
>
> Yeah, I had trouble getting that to work nicely with the ijconsole
> input. See below for more details.
>
> > You might want to use an aux-file for that.  Name it
> > jsoftware/profile.ijs if it's just a plain file (which I assume). 
> > I recently pushed a commit towards renpy which replaces a large
> > format block by fetching an auxiliary file and substitute*, which
> > you can take as reference if you're unsure.  Note that renpy still
> > uses old-style inputs, so the assoc-ref makes sense in that case;
> > however, you should be able to also express this pattern in terms
> > of search-input-file somehow (or otherwise express it as gexp).
>
> Oooh. Neat. That makes adding and testing changes their much nicer.
>
> Note, I wasn't able to find a nice way to get this working together
> with the new inputs syntax, since `search-input-files' only searches
> under input paths which are directories.
>
> The ijconsole and profilex input are regular files, so it raises a
> search-error. One workaronud is to put ijconsole and profilex
> together under a file-union input, but I found that almost worse than
> just using old-style syntax.
>
> If you have a better idea, I am all ears.
You could define that file-union right after ijconsole. If you want to
golf even more, you could define ijconsole inside that file-union, i.e.
(define jsoftware-aux-files
(file-union "jsoftware-aux-files"
`(("profile.ijs" ,(search-aux-file ...)
("ijconsole" ,(program-file ...))))

I'm not quite sure if you want to use jsoftware-aux-files directly as
input or whether it's wiser to stuff it into another union like
(file-union "jsoftware-aux-input" `(("aux" ,jsoftware-aux-files))).
search-input-file will probably do the right thing regardless.
The new style should also still work with assoc-ref, it'd just be
weirder to look at. Lastly, you could code up a (search-file-input)
just in case; I'm not sure if we have one already.

Cheers
E
E
elaexuotee wrote on 16 Jan 2022 16:19
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
24FU0VP6N4ZZ7.3PE5LG30BSNUQ@wilsonb.com
Toggle quote (6 lines)
> > Interesting idea. How about just always forcing a MINOR part, setting
> > to "0" if upstream doesn't have one?
> That'd declare regular releases as MAJOR.0 in the version field, which
> I'm not sure if we want that. In the case of random commits I'm less
> reserved, as they don't correspond to releases anyway.

I see your point. In fact, upstream releases start with MINOR part "a" and
"count up" through the letters over the course of a year. It's a pretty simple
scheme. For example, J 901 started at "j901-release-a" and ended at
"j901-release-f".

When I originally wrote this package, I noticed that the release tag for the
first J 902 was "j902-release", and so treaded MINOR as potentially optional.
However, after checking upstream's forums, this looks to just be a git tag
mishap.

How about we just go ahead and treat MINOR as mandatory as well?


Toggle quote (16 lines)
> > If you have a better idea, I am all ears.
> You could define that file-union right after ijconsole. If you want to
> golf even more, you could define ijconsole inside that file-union, i.e.
> (define jsoftware-aux-files
> (file-union "jsoftware-aux-files"
> `(("profile.ijs" ,(search-aux-file ...)
> ("ijconsole" ,(program-file ...))))
>
> I'm not quite sure if you want to use jsoftware-aux-files directly as
> input or whether it's wiser to stuff it into another union like
> (file-union "jsoftware-aux-input" `(("aux" ,jsoftware-aux-files))).
> search-input-file will probably do the right thing regardless.
> The new style should also still work with assoc-ref, it'd just be
> weirder to look at. Lastly, you could code up a (search-file-input)
> just in case; I'm not sure if we have one already.

The file-union seems like a cludgy workaround to me. What we really want is an
easy, direct way to get handles on the input files. Heck, program-file objects
already have a name property; why can't we use that? Attached patches are a
proof-of-concept.

That said, if this is going to turn into a big rabbit hole, can we just munge
the J package inputs into whatever you think is best?
From 3b8e7fa8fbd58e7e164e3730c708419f612b8549 Mon Sep 17 00:00:00 2001
From: "B. Wilson" <elaexuotee@wilsonb.com>
Date: Sun, 16 Jan 2022 23:54:51 +0900
Subject: [PATCH 1/2] packages: Expand range of objects 'add-input-label' can
label
To: guix-patches@gnu.org

* guix/packages.scm (%auxiliary-files-subpath-dir): New variable.
(add-input-label): Support labels from the name property of
objects that have one. Also, name auxiliary files from their
subpath.
---
guix/packages.scm | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)

Toggle diff (51 lines)
diff --git a/guix/packages.scm b/guix/packages.scm
index 9d5b23eb8a..4feea8ad5f 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2022 B. Wilson <elaexuotee@wilsonb.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -569,6 +570,10 @@ (define-record-type* <package>
(default (current-definition-location))
(innate)))
+;; Note: This morally imports from gnu/packages.scm, but since they import us,
+;; we define here instead.
+(define %auxiliary-files-subdir-path "/gnu/packages/aux-files")
+
(define (add-input-label input)
"Add an input label to INPUT."
(match input
@@ -576,7 +581,24 @@ (define (add-input-label input)
(list (package-name package) package))
(((? package? package) output) ;XXX: ugly?
(list (package-name package) package output))
- ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored?
+ ((? local-file? local-file)
+ (list (local-file-name local-file) local-file))
+ ((? plain-file? plain-file)
+ (list (plain-file-name plain-file) plain-file))
+ ((? computed-file? computed-file)
+ (list (computed-file-name computed-file) computed-file))
+ ((? program-file? program-file)
+ (list (program-file-name program-file) program-file))
+ ((? scheme-file? scheme-file)
+ (list (scheme-file-name scheme-file) scheme-file))
+ ((? string? path)
+ (let* ((regex (string-append %auxiliary-files-subdir-path "/(.*)"))
+ (match (string-match regex input)))
+ `(,(if match
+ (match:substring match 1)
+ "_")
+ ,input)))
+ ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored?
(let ((obj (gexp-input-thing input))
(output (gexp-input-output input)))
`(,(if (package? obj)
--
2.34.0
L
L
Liliana Marie Prikler wrote on 16 Jan 2022 20:53
(address . elaexuotee@wilsonb.com)
e1aa36040fe6bb590834410d482bb8027603f2cc.camel@gmail.com
Hi,

Am Montag, dem 17.01.2022 um 00:19 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (18 lines)
> > > Interesting idea. How about just always forcing a MINOR part,
> > > setting to "0" if upstream doesn't have one?
> > That'd declare regular releases as MAJOR.0 in the version field,
> > which I'm not sure if we want that.  In the case of random commits
> > I'm less reserved, as they don't correspond to releases anyway.
>
> I see your point. In fact, upstream releases start with MINOR part "a"
> and "count up" through the letters over the course of a year. It's a
> pretty simple scheme. For example, J 901 started at "j901-release-a"
> and ended at "j901-release-f".
>
> When I originally wrote this package, I noticed that the release tag
> for the first J 902 was "j902-release", and so treaded MINOR as
> potentially optional.
> However, after checking upstream's forums, this looks to just be a git
> tag mishap.
>
> How about we just go ahead and treat MINOR as mandatory as well?
In other words minor should always have a value >= "a" and 902 was just
missing it? Fair enough, in that case making version mandatory sounds
like the way to go.

Toggle quote (22 lines)
> > > If you have a better idea, I am all ears.
> > You could define that file-union right after ijconsole.  If you want
> > to
> > golf even more, you could define ijconsole inside that file-union,
> > i.e.
> >   (define jsoftware-aux-files
> >     (file-union "jsoftware-aux-files"
> >       `(("profile.ijs" ,(search-aux-file ...)
> >         ("ijconsole" ,(program-file ...))))
> >
> > I'm not quite sure if you want to use jsoftware-aux-files directly as
> > input or whether it's wiser to stuff it into another union like
> > (file-union "jsoftware-aux-input" `(("aux" ,jsoftware-aux-files))).
> > search-input-file will probably do the right thing regardless.
> > The new style should also still work with assoc-ref, it'd just be
> > weirder to look at.  Lastly, you could code up a (search-file-input)
> > just in case; I'm not sure if we have one already.
>
> The file-union seems like a cludgy workaround to me. What we really
> want is an easy, direct way to get handles on the input files. Heck,
> program-file objects already have a name property; why can't we use
> that? Attached patches are a proof-of-concept.
That proof of concept does look nice, but for one we're trying to move
away from labels, and for the other, it's on a scale that I don't want
to decide as part of a package addition. If you feel it has value
outside of the proposed usage for j, discussing it under a different
number or perhaps on guix-devel might be worth it.

Toggle quote (2 lines)
> That said, if this is going to turn into a big rabbit hole, can we just
> munge the J package inputs into whatever you think is best?
As said in my previous mail, that'd be
Toggle quote (4 lines)
> > (define jsoftware-aux-files
> > (file-union "jsoftware-aux-files"
> > `(("profile.ijs" ,(search-aux-file ...)
> > ("ijconsole" ,(program-file ...))))
In my personal opinion, you can then simply add jsoftware-aux-files as
input and (search-input-file "ijconsole") instead of the current assoc-
ref. WDYT?

Don't worry, I don't plan to drag this out too long, but I also don't
planning on pushing this today. There are definitely some stylistic
choices that I want to make under the considerations here (basically,
we can just merge major and minor into a single base that'd be "903.a",
for example), but it's almost bedtime and I want to relax a little
before going to sleep.

Cheers
E
E
elaexuotee wrote on 17 Jan 2022 02:24
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
2EZU214MJAIBY.3EXSPSUMS5WW5@wilsonb.com
Again, thanks for the consistent quick turn-around, lately.

Toggle quote (5 lines)
> > How about we just go ahead and treat MINOR as mandatory as well?
> In other words minor should always have a value >= "a" and 902 was just
> missing it? Fair enough, in that case making version mandatory sounds
> like the way to go.

Exactly.

Thanks to your close reading of the patch and your opinionated suggestions, we
were able to catch this

Toggle quote (10 lines)
> > The file-union seems like a cludgy workaround to me. What we really
> > want is an easy, direct way to get handles on the input files. Heck,
> > program-file objects already have a name property; why can't we use
> > that? Attached patches are a proof-of-concept.
> That proof of concept does look nice, but for one we're trying to move
> away from labels, and for the other, it's on a scale that I don't want
> to decide as part of a package addition. If you feel it has value
> outside of the proposed usage for j, discussing it under a different
> number or perhaps on guix-devel might be worth it.

Of course. It would be kind of ridiculous to merge some random, only vaguely
related patch deep in the internals of the system, as part of a simple package
addendum.

We're not writing bills for the Senate here!

Whether or not the patch is valuable, I could learn a lot from any ensuing
discussion, so I might take up your idea to post separately.

Toggle quote (11 lines)
> > That said, if this is going to turn into a big rabbit hole, can we just
> > munge the J package inputs into whatever you think is best?
> As said in my previous mail, that'd be
> > > (define jsoftware-aux-files
> > > (file-union "jsoftware-aux-files"
> > > `(("profile.ijs" ,(search-aux-file ...)
> > > ("ijconsole" ,(program-file ...))))
> In my personal opinion, you can then simply add jsoftware-aux-files as
> input and (search-input-file "ijconsole") instead of the current assoc-
> ref. WDYT?

Sounds clear to me!

However, for some reason, right now if 'search-auxiliary-file' is inside a
file-union, I'm getting ENOENT on the file somewhere:

Backtrace:
2 (primitive-load "/gnu/store/fk7mr923n47r7wj7xqlfmh80jc5?")
In ice-9/eval.scm:
619:8 1 (_ #f)
In unknown file:
0 (stat "/home/x/devel/org.gnu.savannah/guix/gnu/package?" ?)

ERROR: In procedure stat:
In procedure stat: No such file or directory: "/home/x/devel/org.gnu.savannah/guix/gnu/packages/aux-files/jsoftware/profilex.ijs"
builder for `/gnu/store/4zhrg7g17bqpmlgp5i58vbsc5g8xsl1s-jsoftware-aux-files.drv' failed with exit code 1
build of /gnu/store/4zhrg7g17bqpmlgp5i58vbsc5g8xsl1s-jsoftware-aux-files.drv failed
View build log at '/var/log/guix/drvs/4z/hrg7g17bqpmlgp5i58vbsc5g8xsl1s-jsoftware-aux-files.drv.bz2'.
cannot build derivation `/gnu/store/ax3nwc5xybqcirxadm4ynz99jsq3l3j7-jsoftware-j-903.a.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/ax3nwc5xybqcirxadm4ynz99jsq3l3j7-jsoftware-j-903.a.drv' failed

Running `stat <path>` from the command line on the offending path succeeds as
expected, and moving the 'search-auxiliary-file' out of the file-union and
into the package inputs lets the build proceed.

I'm stumped. Attached is the package definition, for reference.


Toggle quote (7 lines)
> Don't worry, I don't plan to drag this out too long, but I also don't
> planning on pushing this today. There are definitely some stylistic
> choices that I want to make under the considerations here (basically,
> we can just merge major and minor into a single base that'd be "903.a",
> for example), but it's almost bedtime and I want to relax a little
> before going to sleep.

Sure. I'm mostly just way out of my depth here, getting sent on deep
rabbit-holes every time you respond give me some feedback to chew on. :P

Definitely down for some stylistic improvements. Let me know!

Hope you got some nice relaxation time in!
Attachment: jsoftware.scm
L
L
Liliana Marie Prikler wrote on 17 Jan 2022 22:12
(address . elaexuotee@wilsonb.com)
befbc28f660ebe87a8a4e86b3901266c9a475931.camel@gmail.com
Hi,

I tried to get J ready for packaging, but thanks to my CPU not
supporting AVX2 and some helpful discussion in IRC, I was able to avoid
an error here.

The (guix cpu) code is not meant to be used at runtime as the comment
to ijconsole implies it wants it to be used. Rather, you should use it
at compile time to bake in the correct tuning parameters, and it should
ideally also support "cross-tuning" (though in that case you probably
need to disable the tests because your CPU won't make sense of the
code). ijconsole not only fails that, but it also fails at an even
more basic task in Guix' launcher scripts, which is actually knowing
the thing you launch. (We hardcode everything, period.)

Now I could just disable everything AVX-related in J and push something
that works on x86 and amd64, but since you do claim that AVX is
important to J, there are also other options one could take here. One
is to implement tuning for this package the correct way, though since
it reinvents build systems, that's probably going to be a hard one.
The other would be to define package variants (e.g. jsoftware-j-with-
avx) and use those -- there ought to be an old blog post on Guix HPC
detailing the rationale behind doing that.

WDYT? Is AVX worth the trouble?
E
E
elaexuotee wrote on 18 Jan 2022 05:01
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
3T4YAXDRKZCAW.2LXSUL7VDA46J@wilsonb.com
Toggle quote (4 lines)
> I tried to get J ready for packaging, but thanks to my CPU not
> supporting AVX2 and some helpful discussion in IRC, I was able to avoid
> an error here.

The black hole has extended it's grip...

Toggle quote (7 lines)
> The (guix cpu) code is not meant to be used at runtime as the comment
> to ijconsole implies it wants it to be used. Rather, you should use it
> at compile time to bake in the correct tuning parameters, and it should
> ideally also support "cross-tuning" (though in that case you probably
> need to disable the tests because your CPU won't make sense of the
> code).

Hrm... Mind if I ask about the rationale? We could go back to scraping
/proc/cpuinfo, but I suspect that's not addressing the issue you have in mind.

Toggle quote (4 lines)
> ijconsole not only fails that, but it also fails at an even more basic task
> in Guix' launcher scripts, which is actually knowing the thing you launch.
> (We hardcode everything, period.)

Okay. I see the logic in that.

The original patch indeed hard-coded paths in the ijconsole script, but that
required having ijconsole be a wrapper package. I thought I was being clever by
eliminating a "needless" wrapper, but it sounds like we can just bring it
back.

Toggle quote (9 lines)
> Now I could just disable everything AVX-related in J and push something
> that works on x86 and amd64, but since you do claim that AVX is
> important to J, there are also other options one could take here. One
> is to implement tuning for this package the correct way, though since
> it reinvents build systems, that's probably going to be a hard one.
> The other would be to define package variants (e.g. jsoftware-j-with-
> avx) and use those -- there ought to be an old blog post on Guix HPC
> detailing the rationale behind doing that.

Not including AVX would be a hard hit.

Morally, the ijconsole script just wraps the libj*.so libs into a "fat binary".
From what I understand, fat binaries are (were?) an accepted solution in the
HPC world. Heck, the libj*.so total up to a whopping 15Mb, which feels more
like slim that fat, anyway.

Questions floating around in my head:

- What is wrong with detecting CPU features in a wrapper vs in the binary?
- If a wrapper is theoretically okay, how can we fix the current one?
- Is such a "proper fix" massively more subtle and bug-prone than the naive
solution? Why?

Toggle quote (2 lines)
> WDYT? Is AVX worth the trouble?

Personally, I really do not like the jsoftware-j-with-* variants workaround. If
you say that tuning support is the only other acceptable solution, then I'll
bite the bullet and see what is possible.


P.S. Just throwing this out there, but if you'd like, I'd be willing to do a
mob session together. It seems like we are in compatible timezones.
L
L
Liliana Marie Prikler wrote on 18 Jan 2022 09:04
(address . elaexuotee@wilsonb.com)
f55cd366d1fcc61303b4519da8da36f91a6ca3c8.camel@gmail.com
Hi,

Am Dienstag, dem 18.01.2022 um 13:01 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (23 lines)
>
>
> > The (guix cpu) code is not meant to be used at runtime as the
> > comment to ijconsole implies it wants it to be used.  Rather, you
> > should use it at compile time to bake in the correct tuning
> > parameters, and it should ideally also support "cross-tuning"
> > (though in that case you probably need to disable the tests because
> > your CPU won't make sense of the code).
>
> Hrm... Mind if I ask about the rationale? We could go back to
> scraping /proc/cpuinfo, but I suspect that's not addressing the issue
> you have in mind.
>
> > ijconsole not only fails that, but it also fails at an even more
> > basic task in Guix' launcher scripts, which is actually knowing the
> > thing you launch. (We hardcode everything, period.)
>
> Okay. I see the logic in that.
>
> The original patch indeed hard-coded paths in the ijconsole script,
> but that required having ijconsole be a wrapper package. I thought I
> was being clever by eliminating a "needless" wrapper, but it sounds
> like we can just bring it back.
As far as I can see, you still need a wrapper to provide a symlink
stripped of the version. I think you can combine the CPU detection
code with that (see below), so you can have a wrapper procedure, which
strips the version LOGICAL OR detects the CPU.

Toggle quote (23 lines)
> > Now I could just disable everything AVX-related in J and push
> > something that works on x86 and amd64, but since you do claim that
> > AVX is important to J, there are also other options one could take
> > here.  One is to implement tuning for this package the correct way,
> > though since it reinvents build systems, that's probably going to
> > be a hard one. The other would be to define package variants (e.g.
> > jsoftware-j-with-avx) and use those -- there ought to be an old
> > blog post on Guix HPC detailing the rationale behind doing that.
>
> Not including AVX would be a hard hit.
>
> Morally, the ijconsole script just wraps the libj*.so libs into a
> "fat binary". From what I understand, fat binaries are (were?) an
> accepted solution in the HPC world. Heck, the libj*.so total up to a
> whopping 15Mb, which feels more like slim that fat, anyway.
>
> Questions floating around in my head:
>
> - What is wrong with detecting CPU features in a wrapper vs in the
> binary?
> - If a wrapper is theoretically okay, how can we fix the current one?
> - Is such a "proper fix" massively more subtle and bug-prone than the
> naive solution? Why?
FWIW I don't quite think that fat binaries are the issue here, but that
building AVX blows up the check phase in the way we currently do. It's
a similar issue w.r.t. check? for cross-compiling. In my opinion only
the base feature set can be checked unless the CPU supports the same
features as the target.

I think if we want to do fat binaries, the solution would be to build
all three variants from make-j and tests only the base variants, and
then have a non-substitutable wrapper package, that takes that as an
input and simply provides a wrapper tuned to the current CPU features.
If you want, you can then rerun the correct tests in the wrapper
package. The package returned by make-j could itself also provide
three binaries just in case someone doesn't want to generate the
wrapper package, but knows they can run ijconsole-avx2 just fine.
WDYT?

Toggle quote (10 lines)
> > WDYT?  Is AVX worth the trouble?
>
> Personally, I really do not like the jsoftware-j-with-* variants
> workaround. If you say that tuning support is the only other
> acceptable solution, then I'll bite the bullet and see what is
> possible.
>
> P.S. Just throwing this out there, but if you'd like, I'd be willing
> to do a mob session together. It seems like we are in compatible
> timezones.
I'm in UTC+1 and have a day job from 8am to 4pm (plus delta and bus
routes), which normally make me unable to reply from roughly 6:30am to
8pm. I'm also a little shy when it comes to letting strangers hear my
voice and experiencing healthy vaccine side effects atm.

Cheers
E
E
elaexuotee wrote on 18 Jan 2022 11:40
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
2GLLHI6YET96V.279HCOFQSZLLF@wilsonb.com
Toggle quote (6 lines)
> FWIW I don't quite think that fat binaries are the issue here, but that
> building AVX blows up the check phase in the way we currently do. It's
> a similar issue w.r.t. check? for cross-compiling. In my opinion only
> the base feature set can be checked unless the CPU supports the same
> features as the target.

Oh, good. Apparently, I mis-interpreted your original concerns.

Toggle quote (10 lines)
> I think if we want to do fat binaries, the solution would be to build
> all three variants from make-j and tests only the base variants, and
> then have a non-substitutable wrapper package, that takes that as an
> input and simply provides a wrapper tuned to the current CPU features.
> If you want, you can then rerun the correct tests in the wrapper
> package. The package returned by make-j could itself also provide
> three binaries just in case someone doesn't want to generate the
> wrapper package, but knows they can run ijconsole-avx2 just fine.
> WDYT?

Slick. Let me check my understanding against yours with some specifics:

- Name make-j's package 'jsoftware-j-lib' which
1. Builds all upstream stuff, and
2. Only runs libj.so (non-avx) tests;

- Create non-substitutable 'jsoftware-j' wrapper package which
1. Detects SSE extensions at build time and specializes the 'ijconsole'
script accordingly, and
2. Runs tests if and only if an avx or avx2 variant.

Does those points jibe with your thoughts on the fat binaries approach?


Glancing around at the CPU tuning stuff, it looks like tunable packages end up
getting a 'cpu-tuning' property which holds the microartecture name passed to
-march. AVX first landed in Sandy Bridge, and AVX2 in Haswell, so assuming
cpu-tuning is accessible at build time, it should be easy enough to condition
the build phase on those.

Regarding the check phase, here's a relevant comment in
guix/transformations.scm(tuned-package):552:

;; The machine building this package may or may not be able to run code
;; for MICRO-ARCHITECTURE. Because of that, skip tests; they are run for
;; the "baseline" variant anyway.

Which I read to mean that the check phase should explicitly use libj.so,
ignoring libj-avx.so and libj-avx2.so. Running specialized tests in a
non-substitutable wrapper seems potentially better in this particular case.


Thoughts?


Toggle quote (5 lines)
> I'm in UTC+1 and have a day job from 8am to 4pm (plus delta and bus
> routes), which normally make me unable to reply from roughly 6:30am to
> 8pm. I'm also a little shy when it comes to letting strangers hear my
> voice and experiencing healthy vaccine side effects atm.

UTC+9 here. Okay. That's unfortunate, but I'll keep the offer open if you
change your mind.

Hope you get to feeling better soon!

Cheers,
B. Wilson
L
L
Liliana Marie Prikler wrote on 18 Jan 2022 12:33
(address . elaexuotee@wilsonb.com)
e38947f2acb66a0e1e08bb533a6473805a343ba4.camel@gmail.com
Am Dienstag, dem 18.01.2022 um 19:40 +0900 schrieb
elaexuotee@wilsonb.com:
Toggle quote (34 lines)
> > FWIW I don't quite think that fat binaries are the issue here, but
> > that building AVX blows up the check phase in the way we currently
> > do. It's a similar issue w.r.t. check? for cross-compiling.  In my
> > opinion only the base feature set can be checked unless the CPU
> > supports the same features as the target.
>
> Oh, good. Apparently, I mis-interpreted your original concerns.
>
> > I think if we want to do fat binaries, the solution would be to
> > build all three variants from make-j and tests only the base
> > variants, and then have a non-substitutable wrapper package, that
> > takes that as an input and simply provides a wrapper tuned to the
> > current CPU features.
> > If you want, you can then rerun the correct tests in the wrapper
> > package.  The package returned by make-j could itself also provide
> > three binaries just in case someone doesn't want to generate the
> > wrapper package, but knows they can run ijconsole-avx2 just fine.
> > WDYT?
>
> Slick. Let me check my understanding against yours with some
> specifics:
>
> - Name make-j's package 'jsoftware-j-lib' which
>   1. Builds all upstream stuff, and
>   2. Only runs libj.so (non-avx) tests;
>
> - Create non-substitutable 'jsoftware-j' wrapper package which
>   1. Detects SSE extensions at build time and specializes the
> 'ijconsole'
>      script accordingly, and
>   2. Runs tests if and only if an avx or avx2 variant.
>
> Does those points jibe with your thoughts on the fat binaries
> approach?
That's roughly what I was suggesting, yes.

Toggle quote (22 lines)
> Glancing around at the CPU tuning stuff, it looks like tunable
> packages end up getting a 'cpu-tuning' property which holds the
> microartecture name passed to -march. AVX first landed in Sandy
> Bridge, and AVX2 in Haswell, so assuming cpu-tuning is accessible at
> build time, it should be easy enough to condition the build phase on
> those.
>
> Regarding the check phase, here's a relevant comment in
> guix/transformations.scm(tuned-package):552:
>
>     ;; The machine building this package may or may not be able to
> run code
>     ;; for MICRO-ARCHITECTURE.  Because of that, skip tests; they are
> run for
>     ;; the "baseline" variant anyway.
>
> Which I read to mean that the check phase should explicitly use
> libj.so, ignoring libj-avx.so and libj-avx2.so. Running specialized
> tests in a non-substitutable wrapper seems potentially better in this
> particular case.
>
> Thoughts?
I can't say that I agree with your reasoning here. Essentially, what
you (or rather the J authors) are doing here is trying to outsmart the
compiler, while Guix assumes, that -march=WHATEVER ought to both
suffice in terms of performance and still be correct. I'm leaning more
towards the assumption that Guix makes here.


If you want to enable tests on your local machine, you can still do so
by inheriting the transformed package. Perhaps we should add a "--
with-tests" transformation as a counterpart to the already existing --
without-tests, which would forcefully enable checks that have been
disabled elsewhere.

Furthermore, tuned-package would still support substitution, you just
need to tell your CI to build for particular micro-architectures. If
you're part of a sufficiently large dev team that uses J with Guix
tooling, that makes a difference between everyone running checks Monday
in the morning or simply fetching a build that has already succeeded on
Sunday.

Cheers
M
M
Maxime Devos wrote on 28 May 2022 14:44
Re: gnu: Add j
(address . 48463@debbugs.gnu.org)
965574970b8cb05cfdb360e761c45a6750b92084.camel@telenet.be
Hi,

There is now a mechanism for tuning packages for particular
subarchitectures without resorting to irreproducible and
unsubstitutable packages, see
Might be useful here.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpIZPRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jqyAQCRTqlSJ8oJn02k+l9/DkGZAURl
EtRRjH5TgIlkVsSZqwEApEizK/QdMhVyOkbjyzvjwIO5qlRjeSY8+a0QhCmb1go=
=UVn5
-----END PGP SIGNATURE-----


J
Re: gnu: Add j.
(address . 48463@debbugs.gnu.org)
87h6d7om80.fsf@dismail.de
Hi!

Is anyone interested in picking this up again?

--
all the best,
jgart
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 48463@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 48463
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch