Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,21 @@ If you get an error message similar to this one:
This means either you don't have check installed or it wasn't found by
the cmake detection script.

To run the python tests run nosetests in the pygpu subdirectory. By
default it will attempt to use 'opencl0:0' as the compute device but
you can override this by setting the DEVICE or GPUARRAY_DEVICE
environement variable, with GPUARRAY_DEVICE having priority, if set.
The format for the device string is '<backend name><device id>'.
Possible backend names are 'cuda' and 'opencl'.

For 'cuda' possible device ids are from 0 to the number of cuda
devices.

For 'opencl' the devices id are of this format '<platform
number>:<device number>'. Both start at 0 and go up to the number of
platforms/devices available. There is no fixed order for the devices,
but the order on a single machine should be stable across runs.
To run the python tests you need to make sure that gpuarray.so is in
the pygpu dir. You can make sure by running

::

python setup.py build_ext --inplace

from the distribution root. Then you only need to point nosetests to
the pygpu/tests directory.

By default it will attempt to run the test on 'opencl0:0'. To use a
different device set the environment variable DEVICE or
GPUARRAY_DEVICE to the desired device name. See the documentation for
:py:meth:`pygpu.gpuarray.init` for more details on the syntax of the
device name.

The test script prints the device name of the chosen device so that
you can confirm which device it is running on.
Expand Down
34 changes: 17 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
def cythonize(arg):
return arg

# clang gives an error if passed -mno-fused-madd
# (and I don't even understand why it's passed in the first place)
if sys.platform =='darwin':
from distutils import sysconfig, ccompiler
sysconfig_customize_compiler = sysconfig.customize_compiler
def customize_compiler(compiler):
sysconfig_customize_compiler(compiler)
if sys.platform == 'darwin':
while '-mno-fused-madd' in compiler.compiler:
compiler.compiler.remove('-mno-fused-madd')
while '-mno-fused-madd' in compiler.compiler_so:
compiler.compiler_so.remove('-mno-fused-madd')
while '-mno-fused-madd' in compiler.linker_so:
compiler.linker_so.remove('-mno-fused-madd')
sysconfig.customize_compiler = customize_compiler
ccompiler.customize_compiler = customize_compiler

try:
from setuptools import setup, Extension as _Extension

Expand All @@ -34,23 +51,6 @@ def __init__(self, *args, **kwargs):

import numpy as np

# clang gives an error if passed -mno-fused-madd
# (and I don't even understand why it's passed in the first place)
if sys.platform =='darwin':
from distutils import sysconfig, ccompiler
sysconfig_customize_compiler = sysconfig.customize_compiler
def customize_compiler(compiler):
sysconfig_customize_compiler(compiler)
if sys.platform == 'darwin':
while '-mno-fused-madd' in compiler.compiler:
compiler.compiler.remove('-mno-fused-madd')
while '-mno-fused-madd' in compiler.compiler_so:
compiler.compiler_so.remove('-mno-fused-madd')
while '-mno-fused-madd' in compiler.linker_so:
compiler.linker_so.remove('-mno-fused-madd')
sysconfig.customize_compiler = customize_compiler
ccompiler.customize_compiler = customize_compiler

to_del = []

for i, a in enumerate(sys.argv):
Expand Down