Skip to content

determine_linux_arch() returns '' for ppc64le machine #660

@davemq

Description

@davemq

Summary:

In trying to use the latest cmdstanpy on an IBM P10-based system, I had problems getting the correct version of cmdstan installed in $HOME/.cmdstan.

Description:

$ uname -a
Linux p181n201 4.18.0-425.13.1.el8_7.ppc64le #1 SMP Thu Feb 2 12:40:32 EST 2023 ppc64le ppc64le ppc64le GNU/Linux
$ python
Python 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:50:28)
[GCC 10.4.0] on linux                                                                                                                                                                        
Type "help", "copyright", "credits" or "license" for more information.                                                                                                                       
>>> from cmdstanpy.utils.cmdstan import determine_linux_arch, get_download_url
>>> import os
>>> import platform
>>> platform.machine()
'ppc64le'
>>> determine_linux_arch()
''
>>> get_download_url('2.31.0')
'https://github.com/stan-dev/cmdstan/releases/download/v2.31.0/cmdstan-2.31.0.tar.gz'
>>> os.environ['CMDSTAN_ARCH'] = "ppc64el"
>>> get_download_url('2.31.0')
'https://github.com/stan-dev/cmdstan/releases/download/v2.31.0/cmdstan-2.31.0-linux-ppc64el.tar.gz'

determine_linux_arch() checks platform.machine() against "ppc64el" and returns "ppc64le" as the architecture. But if platform.machine() is "ppc64le", it returns "". The logic in get_download_url() then defaults to downloading the untagged release tarball, causing additional work to build cmdstan.

Setting the CMSTAN_ARCH environment variable to "ppc64el" as a workaround works because https://github.com/stan-dev/cmdstan/releases/download/v2.31.0/cmdstan-2.31.0-linux-ppc64el.tar.gz exists.

The code in determine_linux_arch() seems backwards and incomplete. If the package uses "ppc64el", determine_linux_arch() should return "ppc64el". So the code should be something like

    elif machine == "ppc64el" or machine == "ppc64le":
        arch = "ppc64el"

Additional Information:

Provide any additional information here.

Current Version:

Please include the output of import cmdstanpy; cmdstanpy.show_versions(), or
at least the cmdstan and cmdstanpy versions used.

INSTALLED VERSIONS

python: 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:50:28)
[GCC 10.4.0]
python-bits: 64
OS: Linux
OS-release: 4.18.0-425.13.1.el8_7.ppc64le
machine: ppc64le
processor: ppc64le
byteorder: little
LC_ALL: None
LANG: C
LOCALE: ('en_US', 'UTF-8')
cmdstan: NOT FOUND
cmdstanpy: 1.1.0
pandas: 1.5.2
xarray: 2022.12.0
tqdm: 4.64.1
numpy: 1.24.2

' '

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions