More packaging ...

This commit is contained in:
Philippe Tillet
2014-10-16 06:57:38 -04:00
parent d4eb3ed820
commit 16c872f38d
22 changed files with 2186 additions and 53 deletions

View File

@@ -1,18 +1,6 @@
find_program(PYTHON "python")
if (PYTHON)
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pyatidlas/__init__.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
configure_file(${SETUP_PY_IN} ${SETUP_PY})
add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})
add_custom_target(pyatidlas ALL DEPENDS ${OUTPUT})
install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
add_subdirectory(pyatidlas)
add_subdirectory(autotune)
endif()

View File

@@ -0,0 +1,13 @@
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
file(GLOB DEPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pysrc/*.py")
LIST(APPEND DEPS "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
configure_file(${SETUP_PY_IN} ${SETUP_PY})
add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})
add_custom_target(autotune ALL DEPENDS ${OUTPUT})
install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")

View File

@@ -0,0 +1,74 @@
Metadata-Version: 1.1
Name: pyopencl
Version: 2014.1
Summary: Python wrapper for OpenCL
Home-page: http://mathema.tician.de/software/pyopencl
Author: Andreas Kloeckner
Author-email: inform@tiker.net
License: MIT
Description: PyOpenCL lets you access GPUs and other massively parallel compute
devices from Python. It tries to offer computing goodness in the
spirit of its sister project `PyCUDA <http://mathema.tician.de/software/pycuda>`_:
* Object cleanup tied to lifetime of objects. This idiom, often
called
`RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_
in C++, makes it much easier to write correct, leak- and
crash-free code.
* Completeness. PyOpenCL puts the full power of OpenCL's API at
your disposal, if you wish. Every obscure `get_info()` query and
all CL calls are accessible.
* Automatic Error Checking. All CL errors are automatically
translated into Python exceptions.
* Speed. PyOpenCL's base layer is written in C++, so all the niceties
above are virtually free.
* Helpful and complete `Documentation <http://documen.tician.de/pyopencl>`_
as well as a `Wiki <http://wiki.tiker.net/PyOpenCL>`_.
* Liberal license. PyOpenCL is open-source under the
`MIT license <http://en.wikipedia.org/wiki/MIT_License>`_
and free for commercial, academic, and private use.
* Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's
CL implementations.
To use PyOpenCL, you just need `numpy <http://numpy.org>`_ and an OpenCL
implementation.
(See this `howto <http://wiki.tiker.net/OpenCLHowTo>`_ for how to get one.)
Places on the web related to PyOpenCL:
* `Python package index <http://pypi.python.org/pypi/pyopencl>`_ (download releases)
.. image:: https://badge.fury.io/py/pyopencl.png
:target: http://pypi.python.org/pypi/pyopencl
* `C. Gohlke's Windows binaries <http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl>`_ (download Windows binaries)
* `Github <http://github.com/pyopencl/pyopencl>`_ (get latest source code, file bugs)
* `Documentation <http://documen.tician.de/pyopencl>`_ (read how things work)
* `Wiki <http://wiki.tiker.net/PyOpenCL>`_ (read installation tips, get examples, read FAQ)
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Other Audience
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
../pyopencl/_mymako.py
../pyopencl/array.py
../pyopencl/algorithm.py
../pyopencl/version.py
../pyopencl/cache.py
../pyopencl/clrandom.py
../pyopencl/reduction.py
../pyopencl/ipython.py
../pyopencl/_cluda.py
../pyopencl/__init__.py
../pyopencl/scan.py
../pyopencl/capture_call.py
../pyopencl/tools.py
../pyopencl/clmath.py
../pyopencl/elementwise.py
../pyopencl/characterize/performance.py
../pyopencl/characterize/__init__.py
../pyopencl/compyte/dtypes.py
../pyopencl/compyte/array.py
../pyopencl/compyte/__init__.py
../pyopencl/cl/pyopencl-ranluxcl.cl
../pyopencl/cl/pyopencl-airy.cl
../pyopencl/cl/pyopencl-eval-tbl.cl
../pyopencl/cl/pyopencl-bessel-y.cl
../pyopencl/cl/pyopencl-bessel-j.cl
../pyopencl/cl/pyopencl-complex.h
../pyopencl/_mymako.pyc
../pyopencl/array.pyc
../pyopencl/algorithm.pyc
../pyopencl/version.pyc
../pyopencl/cache.pyc
../pyopencl/clrandom.pyc
../pyopencl/reduction.pyc
../pyopencl/ipython.pyc
../pyopencl/_cluda.pyc
../pyopencl/__init__.pyc
../pyopencl/scan.pyc
../pyopencl/capture_call.pyc
../pyopencl/tools.pyc
../pyopencl/clmath.pyc
../pyopencl/elementwise.pyc
../pyopencl/characterize/performance.pyc
../pyopencl/characterize/__init__.pyc
../pyopencl/compyte/dtypes.pyc
../pyopencl/compyte/array.pyc
../pyopencl/compyte/__init__.pyc
../pyopencl/_cl.so
../pyopencl/_pvt_struct.so
./
dependency_links.txt
SOURCES.txt
top_level.txt
requires.txt
not-zip-safe
PKG-INFO

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
pytools>=2014.2
pytest>=2
decorator>=3.2.0

View File

@@ -0,0 +1,3 @@
_cl
_pvt_struct
pyopencl

View File

@@ -1,16 +1,12 @@
from __future__ import division
import argparse
import itertools
import os
import argparse, itertools, os, sys
import misc_tools, optimize
import pyopencl as cl
import pyviennacl as vcl
import pyatidlas as atd
import tools
import optimize
import sys
from configobj import ConfigObj
from numpy import random
@@ -73,7 +69,7 @@ def do_tuning(config_fname, viennacl_root):
with vcl.Statement(node) as statement:
if parameters:
TemplateType = TYPES[operation]['template']
return tools.benchmark(TemplateType(TemplateType.Parameters(*parameters),*other_params), statement, device)
return misc_tools.benchmark(TemplateType(TemplateType.Parameters(*parameters),*other_params), statement, device)
print('-----')
print(' '.join(map(str, ("Now tuning:", datatype.__name__, '-', operation, '-'.join(other_params), '[' + device.name, '(' + device.platform.name + ')] for sizes', sizes))))
with open(fname, "w+") as archive:
@@ -84,7 +80,7 @@ def do_tuning(config_fname, viennacl_root):
if 'size' in p:
profile = execution_handler(map_to_list(int, p['size']))
if 'viennacl-src-root' in config:
tools.update_viennacl_headers(config['viennacl-src-root'],device,datatype,operation,additional_parameters,profile)
misc_tools.update_viennacl_headers(config['viennacl-src-root'],device,datatype,operation,additional_parameters,profile)
else:
def compute_perf(x, t):
return TYPES[operation]['perf-index']([datatype().itemsize, x, t])

View File

@@ -1,8 +1,5 @@
import random
import time
import sys
import tools
import copy
import random, time, sys, copy
import misc_tools
import numpy as np
import pyatidlas as atd
@@ -101,8 +98,8 @@ class GeneticOperators(object):
registers_usage = template.registers_usage(vcl.pycore.StatementsTuple(self.statement))/4
lmem_usage = template.lmem_usage(vcl.pycore.StatementsTuple(self.statement))
local_size = template.parameters.local_size_0*template.parameters.local_size_1
occupancy_record = tools.OccupancyRecord(self.device, local_size, lmem_usage, registers_usage)
if not tools.skip(template, self.statement, self.device):
occupancy_record = misc_tools.OccupancyRecord(self.device, local_size, lmem_usage, registers_usage)
if not misc_tools.skip(template, self.statement, self.device):
result.append(creator.Individual(bincode))
break
return result
@@ -119,7 +116,7 @@ class GeneticOperators(object):
parameters = self.decode(new_individual)
template = self.build_template(self.TemplateType.Parameters(*parameters))
#print tools.skip(template, self.statement, self.device), parameters
if not tools.skip(template, self.statement, self.device):
if not misc_tools.skip(template, self.statement, self.device):
break
return new_individual,
@@ -128,7 +125,7 @@ class GeneticOperators(object):
parameters = self.decode(individual)
template = self.build_template(self.TemplateType.Parameters(*parameters))
try:
tt = tools.benchmark(template, self.statement, self.device)
tt = misc_tools.benchmark(template, self.statement, self.device)
self.out.write(','.join([str(tt)]+map(str,map(int,parameters)))+'\n')
self.cache[tuple(individual)] = tt
except:

View File

@@ -1,11 +1,6 @@
import array
import numpy as np
import random
import sys
import itertools
import tools
import array, random, itertools
import deap.tools
import numpy as np
from genetic import GeneticOperators

33
python/autotune/setup.py Normal file
View File

@@ -0,0 +1,33 @@
import os
import sys
from setuptools import Extension, setup
from cx_Freeze import setup, Executable
def main():
sys.path.append('/home/philippe/Development/ATIDLAS/build/python/pyatidlas/build/lib.linux-x86_64-2.7/')
sys.path.append('/home/philippe/Development/pyviennacl-dev/build/lib.linux-x86_64-2.7/')
sys.path.append(os.path.join('${CMAKE_CURRENT_SOURCE_DIR}','pysrc'))
extdir = os.path.join('${CMAKE_CURRENT_SOURCE_DIR}','external')
buildOptions = dict(packages = ['scipy.sparse.csgraph._validation',
'scipy.special._ufuncs_cxx',
'scipy.sparse.linalg.dsolve.umfpack',
'scipy.integrate.vode',
'scipy.integrate.lsoda',
'sklearn.utils.sparsetools._graph_validation',
'sklearn.utils.lgamma'],
excludes = ['matplotlib'],
bin_path_includes = ['/usr/lib/x86_64-linux-gnu/'],
include_files = [(os.path.abspath(os.path.join(extdir, x)), x) for x in os.listdir(extdir)])
base = 'Console'
executables = [
Executable(os.path.join('${CMAKE_CURRENT_SOURCE_DIR}','pysrc','autotune.py'), base=base)
]
setup(name='atidlas-tune',
version = '1.0',
description = 'Auto-tuner for ATIDLAS',
options = dict(build_exe = buildOptions),
executables = executables)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,13 @@
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
file(GLOB DEPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pyatidlas/*.py")
list(APPEND DEPS "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
configure_file(${SETUP_PY_IN} ${SETUP_PY})
add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})
add_custom_target(pyatidlas ALL DEPENDS ${OUTPUT})
install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")

View File

@@ -40,8 +40,10 @@ def main():
cvars = sysconfig.get_config_vars()
cvars['OPT'] = "-DNDEBUG -O3 " + str.join(' ', remove_prefixes(cvars['OPT'].split(), ['-g', '-O', '-Wstrict-prototypes', '-DNDEBUG']))
cvars["CFLAGS"] = cvars["BASECFLAGS"] + " " + cvars["OPT"]
DEFINES = [('VIENNACL_WITH_OPENCL',None), ('VIENNACL_WITH_OPENMP', None)]
cvars["LDFLAGS"] = '-Wl,--no-as-needed ' + cvars["LDFLAGS"]
DEFINES = [('VIENNACL_WITH_OPENCL',None), ('VIENNACL_WITH_OPENMP', None),
('boost','pyviennaclboost')]
INCLUDE_DIRS = ['/home/philippe/Development/pyviennacl-dev/external/boost-python-ublas-subset/boost_subset/',
'${PROJECT_SOURCE_DIR}',
'/home/philippe/Development/pyviennacl-dev/external/viennacl-dev']
@@ -56,7 +58,7 @@ def main():
author_email='ptillet@g.harvard.edu',
classifiers=[
'Environment :: Console',
'Development Status :: 5 - Production/Stable',
'Development Status :: 1 - Experimental',
'Intended Audience :: Developers',
'Intended Audience :: Other Audience',
'Intended Audience :: Science/Research',
@@ -92,17 +94,5 @@ def main():
cmdclass={'build_ext': build_ext_subclass}
)
#from cx_Freeze import setup, Executable
#buildOptions = dict(packages = [], excludes = ['matplotlib'])
#base = 'Console'
#executables = [
# Executable('autotune/autotune.py', base=base)
#]
#setup(name='atidlas-tune',
# version = '1.0',
# description = 'Auto-tuning facility for ATIDLAS',
# options = dict(build_exe = buildOptions),
# executables = executables)
if __name__ == "__main__":
main()