Skip to content

GPUArray.__div__ does not comply with numpy #360

Open

Description

@kaushikcfd

Here's an MWE:

>>> import pycuda.autoinit
>>> import pycuda.gpuarray as cu_np
>>> a = cu_np.zeros(10, dtype="int32") + 1
>>> b = cu_np.zeros(10, dtype="int32") + 2
>>> a / b
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=int32)

while, Numpy returns an array of 0.5's

>>> import numpy as np
>>> a = np.zeros(10, "int32") + 1
>>> b = np.zeros(10, "int32") + 2
>>> a / b
array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])

Activity

  1. inducer commented on Jun 30, 2022

    @inducer
    Owner

    That's clearly a bug. Believe it or not, PyCUDA predates __truediv__, I think. 😲

  2. kaushikcfd commented on Aug 26, 2022

    @kaushikcfd
    ContributorAuthor
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions