|
1 | 1 | from setuptools import setup, find_packages
|
| 2 | +import ctypes |
2 | 3 |
|
3 | 4 |
|
| 5 | +def checkCUDAisAvailable(): |
| 6 | + """ |
| 7 | + This function check if any of this possible libs are available. |
| 8 | + see https://gist.github.com/f0k/63a664160d016a491b2cbea15913d549 |
| 9 | +
|
| 10 | + Returns: |
| 11 | + -------- |
| 12 | + libsOk : bool |
| 13 | + If True then CUDA is available |
| 14 | + """ |
| 15 | + # some possible lib names |
| 16 | + libnames = ('libcuda.so', 'libcuda.dylib', 'cuda.dll') |
| 17 | + libsOk = True |
| 18 | + for libname in libnames: |
| 19 | + try: |
| 20 | + cuda = ctypes.CDLL(libname) |
| 21 | + except OSError: |
| 22 | + continue |
| 23 | + else: |
| 24 | + break |
| 25 | + else: |
| 26 | + libsOk = False |
| 27 | + return libsOk |
| 28 | + |
| 29 | +def getRequirements(): |
| 30 | + """ |
| 31 | + This function it's used in order to get the package names. Which |
| 32 | + depends on the libs available in the machine. |
| 33 | +
|
| 34 | + Return: |
| 35 | + ------- |
| 36 | + conditionalRequirements: list |
| 37 | + A list of strings containing the pip pkgs. |
| 38 | + """ |
| 39 | + cudaLibsOk = checkCUDAisAvailable() |
| 40 | + |
| 41 | + conditionalRequirements = [] |
| 42 | + if cudaLibsOk: |
| 43 | + conditionalRequirements += ["tensorflow-gpu==1.15.3", ] |
| 44 | + else: |
| 45 | + print("\n CUDA it's not available in your machine.") |
| 46 | + print(" You won't be able to use the GPU support.\n") |
| 47 | + conditionalRequirements += ["tensorflow==1.15.3", ] |
| 48 | + |
| 49 | + return conditionalRequirements |
| 50 | + |
| 51 | +conditionalRequirements = getRequirements() |
| 52 | +install_requires = ["scipy", "numpy"] + conditionalRequirements |
| 53 | + |
4 | 54 | with open("README.md", "r") as f:
|
5 | 55 | README_TEXT = f.read()
|
6 | 56 |
|
7 | 57 | setup(
|
8 | 58 | name="emate",
|
9 |
| - version="v1.0.4", |
| 59 | + version="v1.1.0", |
10 | 60 | packages=find_packages(exclude=["build", ]),
|
11 | 61 | long_description=README_TEXT,
|
12 | 62 | long_description_content_type="text/markdown",
|
13 |
| - install_requires=["tensorflow==1.15.0", "scipy", "numpy"], |
| 63 | + install_requires=install_requires, |
14 | 64 | include_package_data=True,
|
15 | 65 | license="MIT",
|
16 |
| - description="", |
| 66 | + description="""eMaTe can run in both CPU and GPU and can |
| 67 | + estimate the spectral density and related trace functions, |
| 68 | + such as entropy and Estrada index, even in matrices |
| 69 | + (directed or undirected graphs) with |
| 70 | + million of nodes.""", |
17 | 71 |
|
18 | 72 | author="Bruno Messias; Thomas K Peron",
|
19 | 73 | download_url="https://github.com/stdogpkg/emate/archive/v1.0.4.tar.gz",
|
|
0 commit comments