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

Windows 64 and numpy's dtype=int #388

Closed
guyer opened this issue Sep 19, 2014 · 3 comments
Closed

Windows 64 and numpy's dtype=int #388

guyer opened this issue Sep 19, 2014 · 3 comments

Comments

@guyer
Copy link
Member

guyer commented Sep 19, 2014

As posted to the [http://thread.gmane.org/gmane.comp.python.fipy/3123 mailing list]:

The attached patch was made against the current "develop" branch. The trac issue tracker at matforge would not allow me to register in order to create a ticket for this ("The page you are looking for is temporarily unavailable"), otherwise I would have put a pull request there on a new ticket.

For some reason that I didn't have the time to dig into sufficiently, it turns out that 64-bit python on 64-bit windows still regards "int" as 32-bit, and not, as the other OSs do, 64-bit. This causes numerous problems with error messages about dtype=int64 not matching with dtype=int32. For example (the one that failed tests for me) the numpy function argmin() returns an array of dtype=int64, but if this result is assigned to an array slice that was created with dtype=int, then errors occur on win64 & py64, but not on other x64 OSs.

The attached patch defines a numerix.INT_DTYPE value that is set based on the detected platform. I then changed a handful of dtype=int references in a few other files, to refer to the new definition in numerix.

After making this change, the fipy tests pass (using the scipy solver; pysparse on py+Windows x64 appears to be afflicted by the same issue and I haven't had a chance to look at it yet) although there are some issues with double_scalars() that appear to be unrelated to the int issue:

F:\CalebHattingh\repos\fipy\examples>C:\WinPython-64bit-2.7.5.0\python-2.7.5.amd
64\python.exe test.py
................................................................................
...f:\calebhattingh\repos\fipy\fipy\variables\variable.py:1165: RuntimeWarning:
divide by zero encountered in double_scalars
  return self._BinaryOperatorVariable(lambda a,b: a/b, other)
................................................................................
.......................f:\calebhattingh\repos\fipy\fipy\solvers\scipy\linearLUSo
lver.py:71: RuntimeWarning: invalid value encountered in double_scalars
  if (numerix.sqrt(numerix.sum(errorVector**2)) / error0)  <= self.tolerance:
.....F:\CalebHattingh\repos\fipy\examples\reactiveWetting\liquidVapor1D.py:3: Ru
ntimeWarning: divide by zero encountered in log
  ##
F:\CalebHattingh\repos\fipy\examples\reactiveWetting\liquidVapor1D.py:18: Runtim
eWarning: divide by zero encountered in double_scalars
  # of their official duties.  Pursuant to title 17 Section 105 of the
.F:\CalebHattingh\repos\fipy\examples\reactiveWetting\liquidVapor2D.py:3: Runtim
eWarning: divide by zero encountered in log
  ##
F:\CalebHattingh\repos\fipy\examples\reactiveWetting\liquidVapor2D.py:22: Runtim
eWarning: divide by zero encountered in double_scalars
  # other parties, and makes no guarantees, expressed or implied, about
...
----------------------------------------------------------------------
Ran 195 tests in 264.878s

OK

Imported from trac ticket #645, created by guyer on 07-03-2013 at 09:52, last modified: 09-30-2013 at 22:27

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

guyer attached win64_numpy_int.patch on 07-03-2013 at 09:53

@fipymigrate
Copy link

In 5e6277d:

#CommitTicketReference repository="fipy" revision="5e6277d694659a05e15ee5c23f3684e6277410da"
Change `int` to `numerix.INT_DTYPE`

Deals with 32/64-bit issues on Windows.

Addresses issue #388

Trac comment by Jonathan Guyer guyer@nist.gov on 09-30-2013 at 15:04

@fipymigrate
Copy link

In 5aa276b:

#CommitTicketReference repository="fipy" revision="5aa276b24f7eb5d721967ba41bf222073e20dced"
Merge branch 'ticket645-Windows_64_and_numpys_dtype_int' into develop

Fixes issue #388

Trac comment by Jonathan Guyer guyer@nist.gov on 09-30-2013 at 22:27

@guyer guyer closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants