trouble running examples

471 views
Skip to first unread message

todicus

unread,
Feb 1, 2011, 6:42:08 PM2/1/11
to sailfish-cfd
Hello --

-- I'm attempting to run Sailfish on Windows XP, using the Python
X,Y environment. Is this a completely silly thing to try? I believe
I've gotten all the required packages installed, and I can definitely
interact with PyCuda from within Python X,Y Spyder IDE. Am now trying
to run the example shown on the first page of the Sailfish reference
manual (http://sailfish.us.edu.pl/index.html), and I have a few
questions:

1) I have no trouble running "from sailfish import geo, lbm" if I type
it in the IPython interpreter, but if I run the example code I get:
"ValueError: numpy.dtype does not appear to be the correct type
object". From some googling I understand that this error is often due
to using a version of Numpy newer than that used to compile Cython
extensions; I am using Numpy 1.5.1. Which files would I need to
recompile?

2) Does lbm.FluidLBMSim still exist? I can not find it in the API
(http://sailfish.us.edu.pl/api.html#module-lbm), or in the source I
got from github. I changed lbm.FluidLBMSim to lbm.LBMSim.

3) After this replacement, I can reach the run() line of the example.
The program errors out with "AttributeError: 'LDCSim' object has no
attribute 'grid'". I have a feeling this is due to using LBMSim
rather than the possibly-more-specified FluidLBMSim. How can I
specify a grid parameter for LBMSim?

4) Finally, when I try running an example from the /examples folder,
specifically lbm_ldc.py, I get
"exceptions.TemplateLookupException(str(e))
TemplateLookupException: Cant locate template for uri u'sailfish/
propagation.mako'". I know the /templates folder is in the Python
path. If I move the .mako files (except lb_single) into the /sailfish/
sailfish directory, the example does run! Is there way to tell
Sailfish how to find the template files?

Thank you very much for your help, I'm eagerly anticipating using this
awesome-looking program!

Cheers --

-- Todd

Michal Januszewski

unread,
Feb 1, 2011, 6:52:10 PM2/1/11
to sailfi...@googlegroups.com
On Wed, Feb 2, 2011 at 00:42, todicus <tod...@gmail.com> wrote:

Hi,

>   -- I'm attempting to run Sailfish on Windows XP, using the Python
> X,Y environment.  Is this a completely silly thing to try?  I believe

It shouldn't be, though for quite sometime I haven't heard about
anybody running Sailfish on Windows. You might very well be exploring
uncharted territory ;)

> 1) I have no trouble running "from sailfish import geo, lbm" if I type
> it in the IPython interpreter, but if I run the example code I get:
> "ValueError: numpy.dtype does not appear to be the correct type
> object".  From some googling I understand that this error is often due

Which module do you get this error from? Could you please post the
full traceback?

> to using a version of Numpy newer than that used to compile Cython
> extensions; I am using Numpy 1.5.1.  Which files would I need to
> recompile?

> 2) Does lbm.FluidLBMSim still exist?  I can not find it in the API
> (http://sailfish.us.edu.pl/api.html#module-lbm), or in the source I
> got from github.  I changed lbm.FluidLBMSim to lbm.LBMSim.

Please don't do that, and use lb_single.FluidLBMSim instead. I
recently split single and binary fluid models into two files
(lb_single, lb_binary) to make the code easier to navigate.

> 3) After this replacement, I can reach the run() line of the example.
> The program errors out with "AttributeError: 'LDCSim' object has no
> attribute 'grid'".  I have a feeling this is due to using LBMSim
> rather than the possibly-more-specified FluidLBMSim.  How can I
> specify a grid parameter for LBMSim?

Short answer: don't, use FludiLBMSim instead.

> 4) Finally, when I try running an example from the /examples folder,
> specifically lbm_ldc.py, I get
> "exceptions.TemplateLookupException(str(e))
> TemplateLookupException: Cant locate template for uri u'sailfish/
> propagation.mako'".  I know the /templates folder is in the Python
> path.  If I move the .mako files (except lb_single) into the /sailfish/
> sailfish directory, the example does run!  Is there way to tell
> Sailfish how to find the template files?

It should find it automatically, provided the sailfish root directory
is in your sys.path. I find it weird that moving them to
sailfish/sailfish works -- the template path explicitly contains
'sailfish/templates/..'. Could you please verify that it is there in
lbm.py, line 438?

Cheers,
--
Michal Januszewski
http://people.gentoo.org/spock

todicus

unread,
Feb 3, 2011, 5:28:33 PM2/3/11
to sailfish-cfd
Hello, thank you for the help Michal! Sailfish examples are running
on Windows XP 32-bit, Nvidia GTX 480 GPU.

Here is the output when running the example script (from the Sailfish
Reference) before manually importing lbm & geo in the interpreter:

In [1]: runfile(r'C:\Simulations\sailfish\sailfish_test.py', wdir=r'C:
\Simulations\sailfish')
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "C:\Python26\lib\site-packages\spyderlib\widgets\externalshell
\startup.py", line 122, in runfile
execfile(filename, glbs)
File "C:\Simulations\sailfish\sailfish_test.py", line 2, in <module>
from sailfish import lbm, geo
File "sailfish\lbm.py", line 33, in <module>
__import__('sailfish', fromlist=[visbackend])
File "sailfish\vis_surf.py", line 15, in <module>
from OpenGL.GL import *
File "C:\Python26\lib\site-packages\OpenGL\GL\__init__.py", line 2,
in <module>
from OpenGL.raw.GL import *
File "C:\Python26\lib\site-packages\OpenGL\raw\GL\__init__.py", line
6, in <module>
from OpenGL.raw.GL.constants import *
File "C:\Python26\lib\site-packages\OpenGL\raw\GL\constants.py",
line 7, in <module>
from OpenGL import platform, arrays
File "C:\Python26\lib\site-packages\OpenGL\arrays\__init__.py", line
22, in <module>
formathandler.FormatHandler.loadAll()
File "C:\Python26\lib\site-packages\OpenGL\arrays\formathandler.py",
line 37, in loadAll
cls.loadPlugin( entrypoint )
File "C:\Python26\lib\site-packages\OpenGL\arrays\formathandler.py",
line 44, in loadPlugin
plugin_class = entrypoint.load()
File "C:\Python26\lib\site-packages\OpenGL\plugins.py", line 14, in
load
return importByName( self.import_path )
File "C:\Python26\lib\site-packages\OpenGL\plugins.py", line 28, in
importByName
module = __import__( ".".join(moduleName), {}, {}, moduleName)
File "C:\Python26\lib\site-packages\OpenGL\arrays\numpymodule.py",
line 25, in <module>
from OpenGL_accelerate.numpy_formathandler import NumpyHandler
File "numpy.pxd", line 30, in OpenGL_accelerate.numpy_formathandler
(src\numpy_formathandler.c:3543)
ValueError: numpy.dtype does not appear to be the correct type object

Using lb_single.FluidLBMSim, I can run the sim! No fluid appears,
however; for that I need to change init_dist(self, dist) to
init_fields(self).

Yes, I have /templates referenced in line 438:

lbm_tmpl = lookup.get_template(os.path.join('sailfish/templates',
self.kernel_file))

I put the Sailfish path in my system path, but nothing changed.
Probably a windows path thing. Even if I hard code the full /
templates path ('C:\\Simulations\\sailfish\\sailfish\\templates'),
into line 438, it does not work. But, easy enough to move the .mako
files!

Just so you know, I'm getting many "Warning: divide by zero
encountered in double_scalars" warnings when running the example.

thank you very much --

-- Todd


On Feb 1, 3:52 pm, Michal Januszewski <mich...@gmail.com> wrote:

Michal Januszewski

unread,
Feb 13, 2011, 4:44:50 PM2/13/11
to sailfi...@googlegroups.com
On Thu, Feb 3, 2011 at 23:28, todicus <tod...@gmail.com> wrote:

Hi,

> Hello, thank you for the help Michal!  Sailfish examples are running
> on Windows XP 32-bit, Nvidia GTX 480 GPU.

That's great news -- we now have success stories for all 3 major
platforms: Linux, Mac OS X and Windows.

> [..]


>  File "C:\Python26\lib\site-packages\OpenGL\arrays\numpymodule.py",
> line 25, in <module>
>    from OpenGL_accelerate.numpy_formathandler import NumpyHandler
>  File "numpy.pxd", line 30, in OpenGL_accelerate.numpy_formathandler
> (src\numpy_formathandler.c:3543)
> ValueError: numpy.dtype does not appear to be the correct type object

It looks like the error is coming from PyOpenGL, which is only used by
the vis_surf module. If you edit VIS_MODULES in lbm.py and remove
'vis_surf', this problem should go away.

> Using lb_single.FluidLBMSim, I can run the sim!  No fluid appears,
> however; for that I need to change init_dist(self, dist) to
> init_fields(self).

Yes, the documentation is really out of date on this one. I created
an issue entry on code.google.com/sailfish-cfd so that we don't forget
to update them.

> I put the Sailfish path in my system path, but nothing changed.
> Probably a windows path thing.  Even if I hard code the full /
> templates path ('C:\\Simulations\\sailfish\\sailfish\\templates'),
> into line 438, it does not work.  But, easy enough to move the .mako
> files!

Agreed, but still this isn't something that should be happening. I
wonder if the mako template lookup could be somehow incompatible with
Windows paths..

> Just so you know, I'm getting many "Warning: divide by zero
> encountered in double_scalars" warnings when running the example.

Which module are they coming from?

Thanks,
Michal

--
Michal Januszewski
http://people.gentoo.org/spock

todicus

unread,
Feb 14, 2011, 2:19:58 PM2/14/11
to sailfish-cfd
Cool - yes, Sailfish is fun to play with! Thank you for writing it!

The divide by zero errors come from double_scalars ("Warning: divide
by zero encountered in double_scalars")

Thank you --

-- Todd



On Feb 13, 1:44 pm, Michal Januszewski <mich...@gmail.com> wrote:

todicus

unread,
Feb 16, 2011, 6:06:39 PM2/16/11
to sailfish-cfd
If anyone is interested in Windows installation of Sailfish, here is
the procedure I used (Windows XP 32-bit with Nvidia GTX 480 GPU, which
already had CUDA installed):

* Followed this page: http://sailfish.us.edu.pl/installation.html
* Python X,Y gave me many of the packages
* NumPy
* SymPy
* MatPlotLib
* Mayavi?

* Found many more binaries for Windows here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycuda
* PyGame
* PyCuda
* Setuptools

* Setuptools lets you type "easy_install" to get:
* Mako
* PyTables

* Installing PyCuda was easy (double-click the installer), just need
to watch a few things:
* add HOME variable to the python environment
* in Spyder, Tools menu -> current user environment variables ->
right-click "insert"
* I set it to:
* 'C:\Simulations folder'


* add MS Visual Studio C compiler to system path
* right-click My Computer -> properties -> Advanced -> Environment
Variables -> edit Path
* paste: C:\Program Files\Microsoft Visual Studio 8\VC\bin; C:
\Program Files\Microsoft Visual Studio 8\Common 7\IDE;

* make sure you can run some examples from http://wiki.tiker.net/PyCuda/Examples
* mandelbrot is cool, obviously!
* must run with 'gpu' command line option



* Move .mako template files from /sailfish/sailfish/templates to /
sailfish/sailfish
* except single_fluid.mako, which stays in the templates folder

* Try running some examples
* from /sailfish/examples
* lbm_ldc.py is cool

Mishal Harbi

unread,
Aug 13, 2016, 5:51:46 AM8/13/16
to sailfish-cfd
Hi,
I run into alot of trouble trying to install pycuda using pip. it complained of not finding cuda.h despite following all the instructions highlight by the other members (adding PATH for CUDA etc etc). I did the logical thing to solve this problem, if it can not find Cuda files, copy the files to where PIP is searching for :) it worked.
I copied all the header files for Cuda from my installation folder;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include
to "c:\python27\include" folder
when the linker complained later of not finding cuda.lib, I copied all the CUDA libraries files from;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib
to a directory that the linker specified in it's command line;
C:\Python27\PCBuild
this directory did not exist under c:\python27 so I just created it and copied the library files into.
PIP then went through the installation of pycuda without a problem.
hope this works.
Regards,
Mishal
Reply all
Reply to author
Forward
0 new messages