Skip to content
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

non-standard location of ucp headers and setup.py #783

Open
zdemat opened this issue Sep 22, 2021 · 3 comments
Open

non-standard location of ucp headers and setup.py #783

zdemat opened this issue Sep 22, 2021 · 3 comments

Comments

@zdemat
Copy link

zdemat commented Sep 22, 2021

setup.py assumes ucp headers be present in a location relative to python include directories root

include_dirs = [os.path.dirname(get_python_inc())]
. . .
with open(include_dirs[0] + "/ucp/api/ucp_version.h") as f:

There can be deployments where UCX is installed in a specific location and location of its headers and libraries is specified by CPATH and LIBRARY_PATH env variables. I can understand this is complex to analyse, however in such situations it is hard to install ucx-py with automation tools, so this is the issue reported.

To be constructive I would suggest to use e.g. value of 'UCX_MODULE_DIR' key provided by ucx_info -c. The simple code below, that can be further optimized, can easily help to locate the headers relative to underlying UCX installation.

import os

def get_ucx_incpath():
    import subprocess
    res = include_dirs[0]
    # get output of ucx_info configuration
    p = subprocess.Popen("ucx_info -c", stdout=subprocess.PIPE, shell=True)
    (output, err) = p.communicate()
    p.wait()
    # get value of UCX_MODULE_DIR key and return path relative to it
    lines = output.decode("utf-8").split('\n')
    ucx_config = {}
    for line in lines:
        if line:
            key, val = line.split('=')
            ucx_config[key] = val
    if 'UCX_MODULE_DIR' in ucx_config.keys():
        res = ucx_config['UCX_MODULE_DIR']
        # remove lib/ucx
        res = os.path.dirname(os.path.dirname(res))
        # add include
        res = os.path.join(res,'include')
    return res

def get_ucp_version():
    with open(os.path.join(get_ucx_incpath(),"ucp/api/ucp_version.h")) as f:
@pentschev
Copy link
Member

Thanks for the report @zdemat . This sounds like a sensible approach to me, would there be any impact on building conda packages if we change it as per the proposal above @jakirkham ?

@zdemat
Copy link
Author

zdemat commented Sep 22, 2021

Thanks @pentschev for considering this issue. It is a good question I hope this is a more general approach utilizing the underlying UCX and I hope it works with conda but I have not considered all consequences.

It is also only the first simple proposal.

@pentschev
Copy link
Member

Yes, definitely, @jakirkham will likely know the answer to that question or perhaps a smart alternative, let's wait for his reply later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants