Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blis package #8925

Merged
merged 33 commits into from
Aug 16, 2018
Merged

Add blis package #8925

merged 33 commits into from
Aug 16, 2018

Conversation

s-sajid-ali
Copy link
Contributor

First pass at adding the blis linear algebra package.

multi=False
)

# TODO: add cpu variants. Currently using auto.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you plan to add this, or is this just a remark for future expansions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some knl specific hbw_malloc options. I'm not sure which is better so I'll let people who use this on knl to add the options in a meaningful way.

from spack import *


class Blis(Package):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert this to AutotoolsPackage? Everything looks pretty standard, you should only need to override configure_args.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It started life in the spack universe as an Autotools package but realizing that they don't use autotools, I changed it back !

Browsing through the repo it looks like this is not designed as an autotools package so do we want to make it one here ? (see flame/blis#17, flame/blis#197, flame/blis#195, etc )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this is a "fake" Autotools package that writes their own script that just happens to be called configure. In that case, you're right, this shouldn't be an Autotools package. Can you add a comment mentioning this so others aren't confused?

"auto")
make()
make('install')
make('check')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally make('check') is run after make() and before make('install'). Do their installation docs say otherwise?

Also, this should be optional. If you change it to:

if self.run_tests:
    make('check')

it will only run the tests if spack install --test is used.


def install(self, spec, prefix):
configure("--prefix=" + self.spec.prefix,
"--enable-threading=" + self.spec.variants['threads'].value,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to use self here since you already have access to spec and prefix.

version('0.3.0', sha256='d34d17df7bdc2be8771fe0b7f867109fd10437ac91e2a29000a4a23164c7f0da')
version('0.2.2', sha256='4a7ecb56034fb20e9d1d8b16e2ef587abbc3d30cb728e70629ca7e795a7998e8')

depends_on('python@2.7:2.8,3.4:')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type=('build', 'run')?

vairant(
'blas', default='false',
description='BLAS compatibility',
values=('true', 'false'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: vairant

Also, none of these variants (aside from threads) should be multi-valued variants. They can be simple traditional boolean variants:

variant('blas', default=False, description='BLAS compatibility')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what exactly does this variant do? Does it still provide blas when blis~blas? None of these variants seem to be passed to the build instructions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do it soon, but here is the explanation
While BLIS exports a new BLAS-like API, it also includes a BLAS compatibility layer which gives application developers access to BLIS implementations via traditional BLAS routine calls. An object-based API unique to BLIS is also available.

provides('blas', when="+blas")
provides('blas', when="+cblas")

phases = ['configure', 'install']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add a phase for build. See http://spack.readthedocs.io/en/latest/build_systems/custompackage.html for examples of how each phase works and how to add testing.

if spec.variants['cblas']:
cblas = "--enable-cblas"
else:
cblas = "--disable-cblas"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of saving these as variables, I would append them to an args list. Then, when you call configure, use:

configure(*args)

That's how most other packages work, and then you don't need to keep track of any additional variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*args unpacks a list into a set of strings ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def build(self, spec, prefix):
make()
if self.run_tests:
make('check')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be made into a separate function like so: http://spack.readthedocs.io/en/latest/build_systems/custompackage.html#testing

Just replace test with check.

phases = ['configure', 'build', 'install']

def configure(self, spec, prefix):
congfig_args = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: congfig -> config

else:
config_args.append("--disable-static")

configure("--prefix=" + spec.prefix,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use prefix here, no need for spec.prefix.

@s-sajid-ali
Copy link
Contributor Author

s-sajid-ali commented Aug 10, 2018

Everything works with gcc but with intel it takes the compiler to be gcc despite passing env['CC']. What am I doing wrong ?

[sajid@xrmlite ~]$ spack install -v --test root blis ^python@3.6.6 %intel@18.0.3
.......
==> Installing blis
==> Using cached archive: /home/sajid/packages/spack/var/spack/cache/blis/blis-0.4.0.tar.gz
==> Staging archive: /home/sajid/packages/spack/var/spack/stage/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd/0.4.0.tar.gz
==> Created stage in /home/sajid/packages/spack/var/spack/stage/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd
==> No patches needed for blis
==> Building blis [Package]
==> Executing phase: 'configure'
==> './configure' '--prefix=/home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-18.0.3/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd' '--enable-threading=none' '--enable-cblas' '--enable-blas' '--enable-shared' '--enable-static' 'CC=/home/sajid/packages/spack/lib/spack/env/intel/icc' 'auto'
configure: detected Linux kernel version 3.10.0-862.9.1.el7.x86_64.
configure: C compiler search list is: gcc clang cc.
configure: using 'gcc' C compiler.
configure: C++ compiler search list is: g++ clang++ c++.
configure: using 'g++' C++ compiler.
configure: found gcc version 7.3.0 (maj: 7, min: 3, rev: 0).

@scheibelp
Copy link
Member

scheibelp commented Aug 13, 2018

Everything works with gcc but with intel it takes the compiler to be gcc despite passing env['CC']. What am I doing wrong ?

The configure script for blis doesn't appear to allow for icc - see get_cc_search_list in https://github.com/flame/blis/blob/master/configure

EDIT: to be clear, the search function doesn't acknowledge the possibility of a compiler binary called icc, although there are other functions which acknowledge that the string "icc" may appear when you call cc --version.

Spack should automatically set CC to be it's compiler wrapper, which will be icc when you set that in the Spec. That is all to say: this should work if you remove the explicit CC= option in the configure function of the blis package.

@s-sajid-ali
Copy link
Contributor Author

s-sajid-ali commented Aug 14, 2018

I removed CC and I still get the same error:

[sajid@xrmlite ~]$ spack install -v blis^python@3.6.6%intel@18.0.3
...
==> Installing blis
==> Fetching https://github.com/flame/blis/archive/0.4.0.tar.gz
######################################################################## 100.0%
==> Staging archive: /home/sajid/packages/spack/var/spack/stage/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd/0.4.0.tar.gz
==> Created stage in /home/sajid/packages/spack/var/spack/stage/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd
==> No patches needed for blis
==> Building blis [Package]
==> Executing phase: 'configure'
==> './configure' '--prefix=/home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-18.0.3/blis-0.4.0-ol33ytxgje4qww32ehx4rsdepcyhdlrd' '--enable-threading=none' '--enable-cblas' '--enable-blas' '--enable-shared' '--enable-static' 'auto'
configure: detected Linux kernel version 3.10.0-693.el7.x86_64.
configure: C compiler search list is: gcc clang cc.
configure: using 'gcc' C compiler.
configure: C++ compiler search list is: g++ clang++ c++.
configure: using 'g++' C++ compiler.
configure: found gcc version 7.3.0 (maj: 7, min: 3, rev: 0).
configure: checking for blacklisted configurations due to gcc 7.3.0.
configure: found assembler ('as') version 2.27 (maj: 2, min: 27, rev: ).

else:
config_args.append("--disable-blas")

if self.variants['shared']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some places you use spec.variants, and in others you use self.variants. I would use the same syntax that every other package uses:

if '+shared' in spec:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

config_args.append("--disable-shared")

if '+static' in spec:
config_args.append("--enable-static")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it already.

@adamjstewart
Copy link
Member

var/spack/repos/builtin/packages/blis/package.py:118: [W293] blank line contains whitespace
var/spack/repos/builtin/packages/blis/package.py:120: [E265] block comment should start with '# '

@s-sajid-ali
Copy link
Contributor Author

@adamjstewart : Fixed the build and test issues. Can you merge this ?

@adamjstewart
Copy link
Member

Yep, just ping me when the Travis tests finish.

@scheibelp
Copy link
Member

scheibelp commented Aug 15, 2018

Did I miss a resolution for #8925 (comment) or did you want to handle that later (EDIT: not necessarily you but I mean are you fine with that being handled later)?

@s-sajid-ali
Copy link
Contributor Author

I don't remember how I fixed it but it's working now.

[sajid@xrmlite spack]$ spack install -v  blis@develop+cblas^python@3.6.6%intel@18.0.3
...
==> Installing blis
==> Cloning git repository: https://github.com/flame/blis.git on branch master
==> No checksum needed when fetching with git
==> Already staged blis-develop-o63fbaqwdapvkovy67ptgpnzz5kzettw in /home/sajid/packages/spack/var/spack/stage/blis-develop-o63fbaqwdapvkovy67ptgpnzz5kzettw
==> No patches needed for blis
==> Building blis [Package]
==> Executing phase: 'configure'
==> './configure' '--prefix=/home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-18.0.3/blis-develop-o63fbaqwdapvkovy67ptgpnzz5kzettw' '--enable-threading=none' '--enable-cblas' '--enable-blas' '--enable-shared' '--enable-static' 'auto'
configure: detected Linux kernel version 3.10.0-693.el7.x86_64.
configure: C compiler search list is: gcc clang cc.
configure: using '/home/sajid/packages/spack/lib/spack/env/intel/icc' C compiler.
configure: C++ compiler search list is: g++ clang++ c++.
configure: using '/home/sajid/packages/spack/lib/spack/env/intel/icpc' C++ compiler.
configure: found icc version 18.0.3 (maj: 18, min: 0, rev: 3).
configure: checking for blacklisted configurations due to /home/sajid/packages/spack/lib/spack/env/intel/icc 18.0.3.
configure: found assembler ('as') version 2.27 (maj: 2, min: 27, rev: ).

@adamjstewart adamjstewart merged commit cde5116 into spack:develop Aug 16, 2018
anderson2981 pushed a commit to anderson2981/spack that referenced this pull request Sep 7, 2018
@s-sajid-ali s-sajid-ali deleted the add_blis branch March 27, 2019 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants