-
Notifications
You must be signed in to change notification settings - Fork 283
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 cuda.py #145
Merged
boegel
merged 9 commits into
easybuilders:develop
from
fgeorgatos:contrib_CUDA_easyblock
Mar 21, 2013
Merged
add cuda.py #145
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
eef7d93
Merge branch 'develop' of github.com:hpcugent/easybuild-easyblocks in…
boegel 399ed28
add cuda.py
fgeorgatos 029d394
don't use full path for Perl install scripts, unset DISPLAY to dance …
boegel b02daf6
Merge pull request #2 from boegel/contrib_CUDA_easyblock
fgeorgatos df8ab65
Merge branch 'contrib_CUDA_easyblock' of github.com:boegel/easybuild-…
boegel 3374653
check whether DISPLAY should be unset, get rid of chmod'ing install d…
boegel 8400aaf
Merge pull request #3 from boegel/contrib_CUDA_easyblock
fgeorgatos 52bbf5f
add docstring, get rid of obsolete mkdir command
boegel 6d61508
Merge pull request #4 from boegel/contrib_CUDA_easyblock
fgeorgatos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
## | ||
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild | ||
# | ||
# Copyright:: Copyright 2012-2013 Cyprus Institute / CaSToRC, University of Luxembourg / LCSB, Ghent University | ||
# Authors:: George Tsouloupas <g.tsouloupas@cyi.ac.cy>, Fotis Georgatos <fotis.georgatos@uni.lu>, Kenneth Hoste | ||
# License:: MIT/GPL | ||
# $Id$ | ||
# | ||
# This work implements a part of the HPCBIOS project and is a component of the policy: | ||
# http://hpcbios.readthedocs.org/en/latest/HPCBIOS_2012-99.html | ||
## | ||
""" | ||
EasyBuild support for CUDA, implemented as an easyblock | ||
|
||
Ref: https://speakerdeck.com/ajdecon/introduction-to-the-cuda-toolkit-for-building-applications | ||
|
||
@author: George Tsouloupas (Cyprus Institute) | ||
@author: Fotis Georgatos (Uni.lu) | ||
@author: Kenneth Hoste (Ghent University) | ||
""" | ||
import os | ||
import stat | ||
|
||
from easybuild.easyblocks.generic.binary import Binary | ||
from easybuild.tools.filetools import patch_perl_script_autoflush, run_cmd, run_cmd_qa | ||
from distutils.version import LooseVersion | ||
|
||
|
||
class EB_CUDA(Binary): | ||
""" | ||
Support for installing CUDA. | ||
""" | ||
|
||
def extract_step(self): | ||
execpath = self.src[0]['path'] | ||
run_cmd("/bin/sh " + execpath + " --noexec --nox11 --target " + self.builddir) | ||
self.src[0]['finalpath'] = self.builddir | ||
|
||
def install_step(self): | ||
|
||
run_cmd("mkdir -p " + self.installdir) | ||
|
||
# define how to run the installer | ||
if LooseVersion(self.version) <= LooseVersion("5"): | ||
install_script = os.path.join(self.builddir, "install-linux.pl") | ||
cmd = install_script + " --prefix=" + self.installdir | ||
else: | ||
# the following would require to include "osdependencies = 'libglut'" because of -samples | ||
# installparams = "-samplespath=%s/samples/ -toolkitpath=%s -samples -toolkit" % (self.installdir, self.installdir)) | ||
installparams = "-toolkitpath=%s -toolkit" % self.installdir | ||
install_script = os.path.join(self.builddir, "cuda-installer.pl") | ||
cmd = install_script + " -verbose -silent " + installparams | ||
|
||
qanda = {} | ||
stdqa = { | ||
"Would you like to remove all CUDA files under .*? (yes/no/abort): ": "no", | ||
} | ||
noqanda = [r"Installation Complete"] | ||
|
||
# patch install script to handle Q&A autonomously | ||
patch_perl_script_autoflush(install_script) | ||
|
||
run_cmd_qa(cmd, qanda, std_qa=stdqa, no_qa=noqanda, log_all=True, simple=True) | ||
|
||
# FIXME (kehoste): what is this about? why chmod the installdir?!? FG: probably obsolete, need to check | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please resolve this ASAP. I bet @georgets knows if this is still required, and if so, why? |
||
try: | ||
os.chmod(self.installdir, stat.S_IRWXU | stat.S_IXOTH | stat.S_IXGRP | stat.S_IROTH | stat.S_IRGRP) | ||
except OSError, err: | ||
self.log.exception("Can't set permissions on %s: %s" % (self.installdir, err)) | ||
|
||
def sanity_check_step(self): | ||
"""Custom sanity check for CUDA.""" | ||
|
||
custom_paths = { | ||
'files': ["bin/%s" % x for x in ["fatbinary", "nvcc", "nvlink", "ptxas"]] + | ||
["%s/lib%s.so" % (x, y) for x in ["lib", "lib64"] for y in ["cublas", "cudart", "cufft", | ||
"curand", "cusparse", "npp"]] + | ||
["open64/bin/nvopencc"], | ||
'dirs': ["include"], | ||
} | ||
|
||
super(EB_CUDA, self).sanity_check_step(custom_paths=custom_paths) | ||
|
||
def make_module_req_guess(self): | ||
"""Specify CUDA custom values for PATH etc.""" | ||
|
||
guesses = super(EB_CUDA, self).make_module_req_guess() | ||
|
||
guesses.update({ | ||
'PATH': ['open64/bin', 'bin'], | ||
'LD_LIBRARY_PATH': ['lib64'], | ||
'CPATH': ['include'], | ||
'CUDA_HOME': [''], | ||
'CUDA_PATH': [''], | ||
}) | ||
|
||
return guesses |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgeorgatos: Please create an issue to fix this. We should actually (optionally) install the samples and use them as a kind of test suite for CUDA, to verify that it works (it should probably be enabled by default). We can dynamically require
libglut
as a dependency if the samples are being built/installed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of the samples install being optional, and passed in via the CUDA-5.0.35.eb file. I think it should be enabled by default but that's not a strong opinion. Then the choice of whether to install the samples is just a change to the EasyConfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that installing the samples should be enabled by default. The
libglut
dependency should be easy to fulfill with EasyBuild.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dedicated issue was created to enhance the easyblock for the samples, see #147.