diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1c2548b --- /dev/null +++ b/LICENSE @@ -0,0 +1,60 @@ +BSD-2-Clause License + +PyVEO is +Copyright (c) 2018 - 2023 Erich Focht, NEC HPC Europe. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore the additional BSD-3-Clause License: + + +# NLCPy License # + +Copyright (c) 2020 NEC Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither NEC Corporation nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/py-veo.spec.in b/py-veo.spec.in index 6d6ad2d..068b576 100644 --- a/py-veo.spec.in +++ b/py-veo.spec.in @@ -8,15 +8,15 @@ Name: %{name} Version: %{version} Release: %{release} Source0: %{name}-%{version}.tar.gz -License: GPLv2 +License: BSD Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} Vendor: Erich Focht Packager: Erich Focht Url: https://github.com/sx-aurora/py-veo -Requires: veoffload -BuildRequires: veoffload-devel +Requires: veoffload-aveo +BuildRequires: veoffload-aveo-devel %description This package provides python bindings to VEO: Vector Engine Offloading. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f28cca2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +numpy +cython +wheel +cffi diff --git a/setup.cfg b/setup.cfg index 94e3e06..5d55546 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,9 @@ [build] executable=/usr/bin/env python +[metadata] +license_files = LICENSE + [bdist_rpm] release = 1 packager = Erich Focht diff --git a/setup.py b/setup.py index 8c081b0..3434929 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import numpy USE_CYTHON = False -ext = ".c" +ext = ".cpp" if "--use-cython" in sys.argv: from Cython.Build import cythonize sys.argv.remove("--use-cython") @@ -53,7 +53,7 @@ packages = [ "veo", "veo.logging" ], author = "Erich Focht", author_email = "efocht@gmail.com", - license = "GPLv2", + license = "BSD", requires = ["future","numpy", "psutil"], description = "Python bindings for the VE Offloading API", url = "https://github.com/sx-aurora/py-veo", @@ -65,7 +65,7 @@ 'Intended Audience :: Education', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: GNU General Public License (GPL)', + 'License :: OSI Approved :: BSD License', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules' diff --git a/veo/__init__.py b/veo/__init__.py index 81f3031..b588aa3 100644 --- a/veo/__init__.py +++ b/veo/__init__.py @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # from veo._veo import * # NOQA diff --git a/veo/_veo.pxd b/veo/_veo.pxd index 457aaa9..cf51b6a 100644 --- a/veo/_veo.pxd +++ b/veo/_veo.pxd @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # from veo.libveo cimport * diff --git a/veo/_veo.pyx b/veo/_veo.pyx index bc39340..9e43348 100644 --- a/veo/_veo.pyx +++ b/veo/_veo.pyx @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # # distutils: language = c++ @@ -296,21 +276,31 @@ cdef class VeoLibrary(object): self.func = dict() self.symbol = dict() - def get_symbol(self, char *symname): + def get_symbol(self, symname): cdef uint64_t res + if isinstance(symname, str): + symname = symname.encode() + elif not isinstance(symname, bytes): + raise TypeError("symname must be either a str or a bytes") + res = veo_get_sym(self.proc.proc_handle, self.lib_handle, symname) if res == 0UL: raise RuntimeError("veo_get_sym '%s' failed" % symname) - self.symbol[symname] = res + self.symbol[symname] = res return res - def find_function(self, char *symname): + def find_function(self, symname): cdef uint64_t res + if isinstance(symname, str): + symname = symname.encode() + elif not isinstance(symname, bytes): + raise TypeError("symname must be either a str or a bytes") + res = veo_get_sym(self.proc.proc_handle, self.lib_handle, symname) if res == 0UL: raise RuntimeError("veo_get_sym '%s' failed" % symname) - func = VeoFunction(self, res, symname) - self.func[symname] = func + func = VeoFunction(self, res, symname) + self.func[symname] = func return func @@ -522,12 +512,16 @@ cdef class VeoProc(object): def i64_to_addr(self, int64_t x): return ConvFromI64.to_ulong(x) - def load_library(self, char *libname): + def load_library(self, libname): + if isinstance(libname, str): + libname = libname.encode('utf-8') + elif not isinstance(libname, bytes): + raise TypeError("ilibname must be either a str or a bytes") cdef uint64_t res = veo_load_library(self.proc_handle, libname) if res == 0UL: raise RuntimeError("veo_load_library '%s' failed" % libname) - lib = VeoLibrary(self, libname, res) - self.lib[libname] = lib + lib = VeoLibrary(self, libname, res) + self.lib[libname] = lib return lib def unload_library(self, VeoLibrary lib): diff --git a/veo/conv_i64.pxi b/veo/conv_i64.pxi index 752949f..3a66618 100644 --- a/veo/conv_i64.pxi +++ b/veo/conv_i64.pxi @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # from libc.stdint cimport * diff --git a/veo/libveo.pxd b/veo/libveo.pxd index ffd6a4a..a9f0c8d 100644 --- a/veo/libveo.pxd +++ b/veo/libveo.pxd @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # # # Interface to libveo diff --git a/veo/sysvshm.pyx b/veo/sysvshm.pyx index 19397fa..a503475 100644 --- a/veo/sysvshm.pyx +++ b/veo/sysvshm.pyx @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # ctypedef int size_t diff --git a/veo/vebuild.py b/veo/vebuild.py index b01ddb3..6336063 100644 --- a/veo/vebuild.py +++ b/veo/vebuild.py @@ -1,32 +1,12 @@ +# Copyright (c) 2018 - 2023 Erich Focht, NEC HPCE. # -# * The source code in this file is based on the soure code of PyVEO. +# Re-integrated and adapted code that has been derived from PyVEO and +# used in NLCPY, therefore: # # # NLCPy License # -# # Copyright (c) 2020 NEC Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither NEC Corporation nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# See LICENSE file for details. # import collections import subprocess