GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: c2capi_map entries missing for iso_c_binding in f2py · Issue #25207 · numpy/numpy

BUG: c2capi_map entries missing for iso_c_binding in f2py #25207

New issue
Copy link
New issue
Copy link
Closed
#25226
Closed
BUG: c2capi_map entries missing for iso_c_binding in f2py#25207
#25226
Copy link
Labels
00 - Bugcomponent: numpy.f2py

Description

@hmenke
hmenke
opened on Nov 20, 2023
Issue body actions

Describe the issue:

In #24555 the implementation of f2cmap was supplemented by definitions from iso_c_binding, however, due to an oversight there are no corresponding c2capi_map entries which results in KeyError during an f2py run.

Reproduce the code example:

subroutine add(A, B, C, N)
   use iso_c_binding, only: c_int64_t
   implicit none
   integer(c_int64_t), intent(in) :: A(*)
   integer(c_int64_t), intent(in) :: B(*)
   integer(c_int64_t), intent(out) :: C(*)
   integer, intent(in) :: N
   integer :: j

   do j = 1, N
      C(j) = A(j)+B(j)
   end do
end subroutine

Error message:

$ python3 -m numpy.f2py -m add add.f90
Reading fortran codes...
        Reading file 'add.f90' (format:free)
Post-processing...
        Block: add
                        Block: add
In: :add:add.f90:add
get_useparameters: no module iso_c_binding info used by add
Applying post-processing hooks...
  character_backward_compatibility_hook
Post-processing (stage 2)...
Building modules...
    Building module "add"...
    Generating possibly empty wrappers"
    Maybe empty "add-f2pywrappers.f"
        Constructing wrapper function "add"...
getarrdims:warning: assumed shape array, using 0 instead of '*'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/__main__.py", line 5, in <module>
    main()
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/f2py2e.py", line 734, in main
    run_main(sys.argv[1:])
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/f2py2e.py", line 496, in run_main
    ret = buildmodules(postlist)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/f2py2e.py", line 418, in buildmodules
    dict_append(ret[name], rules.buildmodule(module, um))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/rules.py", line 1298, in buildmodule
    api, wrap = buildapi(nb)
                ^^^^^^^^^^^^
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/rules.py", line 1476, in buildapi
    vrd = capi_maps.sign2map(a, var[a])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/capi_maps.py", line 602, in sign2map
    ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)
                                            ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.12/site-packages/numpy/f2py/capi_maps.py", line 410, in getpydocsign
    c2pycode_map[
KeyError: 'int64_t'

Runtime information:

>>> import sys, numpy; print(numpy.__version__); print(sys.version)
1.26.2
3.12.0 (main, Oct  2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)]
>>> print(numpy.show_runtime())
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.26.2',
  'python': '3.12.0 (main, Oct  2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red '
            'Hat 13.2.1-3)]',
  'uname': uname_result(system='Linux', node='0794a3b936a4', release='5.15.0-78-generic', version='#85~20.04.1-Ubuntu SMP Mon Jul 17 09:42:39 UTC 2023', machine='x86_64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2',
                                'AVX512F',
                                'AVX512CD',
                                'AVX512_SKX',
                                'AVX512_CLX'],
                      'not_found': ['AVX512_KNL',
                                    'AVX512_KNM',
                                    'AVX512_CNL',
                                    'AVX512_ICL']}}]
None

Context for the issue:

Workaround: Create a .f2py_f2cmap with the contents

{'integer':{'c_int64_t':'long_long'}}
Reacted by Rohit Goswami

Activity

  1. hmenke
    added
    00 - Bug
    on Nov 20, 2023
  2. HaoZeke
    added
    component: numpy.f2py
    on Nov 21, 2023
  3. HaoZeke
    added 7 commits that reference this issue on Nov 22, 2023

    TST: Add one for numpygh-25207

    3dd34f6

    BUG: Work with the ISOC_BINDINGS more consisently

    dbd86e7

    TST: Add a another test for numpygh-25207

    809bd0f

    TST: Add one for numpygh-25207

    d285c0b

    BUG: Work with the ISOC_BINDINGS more consisently

    e19b324

    TST: Add a another test for numpygh-25207

    e7e246c

    TST: Add a another test for numpygh-25207

    842e39f
  4. mattip
    closed this as completedin #25226on Dec 18, 2023
  5. charris
    added 3 commits that reference this issue on Dec 23, 2023

    TST: Add one for numpygh-25207

    3e6606e

    BUG: Work with the ISOC_BINDINGS more consisently

    d7e78b6

    TST: Add a another test for numpygh-25207

    da7713d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    00 - Bugcomponent: numpy.f2py

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.