sailfish-team / sailfish Goto Github PK
View Code? Open in Web Editor NEWLattice Boltzmann (LBM) simulation package for GPUs (CUDA, OpenCL)
Home Page: http://sailfish.us.edu.pl
Lattice Boltzmann (LBM) simulation package for GPUs (CUDA, OpenCL)
Home Page: http://sailfish.us.edu.pl
Latest version of tvtk already supports VTK-6, however small changes should be conveniently implemented in sailfish to extend such feature.
It is working to me with the following patch:
diff --git a/sailfish/io.py b/sailfish/io.py
index 53b8aac..8c838a2 100644
--- a/sailfish/io.py
+++ b/sailfish/io.py
@@ -190,6 +190,7 @@ class VTKOutput(LBOutput):
self.mask_nonfluid_nodes()
os.environ['ETS_TOOLKIT'] = 'null'
from tvtk.api import tvtk
+ from tvtk.common import configure_input
idata = tvtk.ImageData(spacing=(1, 1, 1), origin=(0, 0, 0))
first = True
@@ -204,7 +205,7 @@ class VTKOutput(LBOutput):
t = idata.point_data.add_array(field.flatten())
idata.point_data.get_array(t).name = name
- idata.update()
+ idata.update_traits()
dim = len(sample_field.shape)
for name, field in self._vector_fields.iteritems():
@@ -223,7 +224,8 @@ class VTKOutput(LBOutput):
idata.dimensions = list(reversed(sample_field.shape)) + [1]
fname = filename(self.basename, self.digits, self.subdomain_id, i, suffix='.vti')
- w = tvtk.XMLImageDataWriter(input=idata, file_name=fname)
+ w = tvtk.XMLImageDataWriter(file_name=fname)
+ configure_input(w, idata)
w.write()
# TODO: Implement this function.
Unfortunately I don't know if it would be incompatible with older versions of tvtk
I recently tried to get Sailfish running under Windows 10 and ran into a problem with the ZeroMQ.
Apparently the IPC protocol is unsupported under Windows and TCP should be used. The problem occurs at this line:
master_addr = 'ipc://{0}/sailfish-master-{1}_{2}'.format(
tempfile.gettempdir(), os.getpid(), subdomain.id)
I expect this is low priority but would it be possible to make this implementation platform agnostic somehow? I am not familiar enough ZMQ to make PR for this myself; when changing the line to the TCP protocol located at '127.0.0.1:5555' i got pickle error about thread.locks.
Xubuntu 15.10, sailfish from master (f111f6e), ATI R9 290
If I launch the Lid-Driven cavity, everything seems to be working fine... Unfortunately it is suddenly hanging:
[ 1751 INFO Master/sobremesa] Machine master starting with PID 25192 at 2016-04-07 18:18:13 UTC
[ 1751 INFO Master/sobremesa] Simulation started with: ./ldc_2d.py
[ 1760 INFO Master/sobremesa] Sailfish version: f111f6e4a0953357f0871374aa825bc2eaafc2a0
[ 1761 INFO Master/sobremesa] Handling subdomains: [0]
[ 1761 INFO Master/sobremesa] Subdomain -> GPU map: {0: 0}
[ 1764 INFO Master/sobremesa] Selected backend: opencl
[ 2291 INFO Subdomain/0] Initializing subdomain.
[ 2291 INFO Subdomain/0] Required memory:
[ 2291 INFO Subdomain/0] . distributions: 5 MiB
[ 2291 INFO Subdomain/0] . fields: 0 MiB
[ 2422 INFO Subdomain/0] On-GPU invalid result check disabled as the device does not support all required features.
/home/pepe/Downloads/sailfish/sailfish/backend_opencl.py:159: UserWarning: Received OpenCL source code in Unicode, should be ASCII string. Attempting conversion.
return cl.Program(self.ctx, preamble + source).build() #'-cl-single-precision-constant -cl-fast-relaxed-math')
[ 5056 WARNING Subdomain/0] Running infinite simulation.
[ 5056 INFO Subdomain/0] Starting simulation.
[ 5510 INFO Subdomain/0] iteration:2000 speed:277.77 MLUPS
[ 5727 INFO Subdomain/0] iteration:3000 speed:295.56 MLUPS
[ 5951 INFO Subdomain/0] iteration:4000 speed:288.61 MLUPS
[ 6175 INFO Subdomain/0] iteration:5000 speed:288.83 MLUPS
[ 6441 INFO Subdomain/0] iteration:6000 speed:243.48 MLUPS
[ 6753 INFO Subdomain/0] iteration:7000 speed:208.11 MLUPS
[ 7033 INFO Subdomain/0] iteration:8000 speed:230.93 MLUPS
[ 7318 INFO Subdomain/0] iteration:9000 speed:227.47 MLUPS
[ 7574 INFO Subdomain/0] iteration:10000 speed:252.54 MLUPS
[ 7808 INFO Subdomain/0] iteration:11000 speed:276.91 MLUPS
[ 8067 INFO Subdomain/0] iteration:12000 speed:250.54 MLUPS
[ 8304 INFO Subdomain/0] iteration:13000 speed:273.10 MLUPS
[ 8595 INFO Subdomain/0] iteration:14000 speed:222.76 MLUPS
[ 8858 INFO Subdomain/0] iteration:15000 speed:246.14 MLUPS
[ 9052 INFO Subdomain/0] iteration:16000 speed:333.59 MLUPS
[ 9260 INFO Subdomain/0] iteration:17000 speed:311.17 MLUPS
[ 9503 INFO Subdomain/0] iteration:18000 speed:266.69 MLUPS
[ 9774 INFO Subdomain/0] iteration:19000 speed:238.98 MLUPS
[ 10013 INFO Subdomain/0] iteration:20000 speed:271.23 MLUPS
[ 10268 INFO Subdomain/0] iteration:21000 speed:253.38 MLUPS
[ 10535 INFO Subdomain/0] iteration:22000 speed:243.09 MLUPS
[ 10782 INFO Subdomain/0] iteration:23000 speed:262.50 MLUPS
[ 11032 INFO Subdomain/0] iteration:24000 speed:258.22 MLUPS
[ 11283 INFO Subdomain/0] iteration:25000 speed:258.77 MLUPS
[ 11527 INFO Subdomain/0] iteration:26000 speed:265.50 MLUPS
[ 11791 INFO Subdomain/0] iteration:27000 speed:245.31 MLUPS
[ 12058 INFO Subdomain/0] iteration:28000 speed:242.33 MLUPS
[ 12311 INFO Subdomain/0] iteration:29000 speed:255.68 MLUPS
[ 12564 INFO Subdomain/0] iteration:30000 speed:256.76 MLUPS
[ 12818 INFO Subdomain/0] iteration:31000 speed:254.30 MLUPS
[ 13066 INFO Subdomain/0] iteration:32000 speed:261.79 MLUPS
[ 13491 INFO Subdomain/0] iteration:33000 speed:152.45 MLUPS
[ 13741 INFO Subdomain/0] iteration:34000 speed:259.01 MLUPS
[ 14018 INFO Subdomain/0] iteration:35000 speed:233.74 MLUPS
[ 14260 INFO Subdomain/0] iteration:36000 speed:267.39 MLUPS
[ 14510 INFO Subdomain/0] iteration:37000 speed:258.93 MLUPS
If I cancel the job, it seems to be a synchronization problem between threads:
File "./ldc_2d.py", line 41, in <module>
ctrl.run()
File "/home/pepe/Downloads/sailfish/sailfish/controller.py", line 793, in run
return self._finish_simulation(subdomain_specs, summary_receiver)
File "/home/pepe/Downloads/sailfish/sailfish/controller.py", line 708, in _finish_simulation
self._simulation_process.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 154, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
However, if I launch the case with the following command:
./ldc_2d.py --debug_single_process
It is hanging again:
[ 1718 INFO MainProcess] Machine master starting with PID 25261 at 2016-04-07 18:21:15 UTC
[ 1718 INFO MainProcess] Simulation started with: ./ldc_2d.py --debug_single_process
[ 1728 INFO MainProcess] Sailfish version: f111f6e4a0953357f0871374aa825bc2eaafc2a0
[ 1729 INFO MainProcess] Handling subdomains: [0]
[ 1729 INFO MainProcess] Subdomain -> GPU map: {0: 0}
[ 1730 INFO MainProcess] Selected backend: opencl
[ 2273 INFO MainProcess] Initializing subdomain.
[ 2273 INFO MainProcess] Required memory:
[ 2273 INFO MainProcess] . distributions: 5 MiB
[ 2273 INFO MainProcess] . fields: 0 MiB
[ 2448 INFO MainProcess] On-GPU invalid result check disabled as the device does not support all required features.
/home/pepe/Downloads/sailfish/sailfish/backend_opencl.py:159: UserWarning: Received OpenCL source code in Unicode, should be ASCII string. Attempting conversion.
return cl.Program(self.ctx, preamble + source).build() #'-cl-single-precision-constant -cl-fast-relaxed-math')
[ 5546 WARNING MainProcess] Running infinite simulation.
[ 5564 INFO MainProcess] Starting simulation.
[ 6078 INFO MainProcess] iteration:2000 speed:266.26 MLUPS
[ 6288 INFO MainProcess] iteration:3000 speed:304.68 MLUPS
[ 6513 INFO MainProcess] iteration:4000 speed:287.41 MLUPS
[ 6740 INFO MainProcess] iteration:5000 speed:285.69 MLUPS
[ 6966 INFO MainProcess] iteration:6000 speed:286.89 MLUPS
[ 7199 INFO MainProcess] iteration:7000 speed:278.13 MLUPS
[ 7452 INFO MainProcess] iteration:8000 speed:255.82 MLUPS
[ 7703 INFO MainProcess] iteration:9000 speed:257.62 MLUPS
[ 7921 INFO MainProcess] iteration:10000 speed:297.96 MLUPS
[ 8164 INFO MainProcess] iteration:11000 speed:266.58 MLUPS
[ 8382 INFO MainProcess] iteration:12000 speed:296.28 MLUPS
[ 8632 INFO MainProcess] iteration:13000 speed:259.16 MLUPS
[ 8895 INFO MainProcess] iteration:14000 speed:246.05 MLUPS
[ 9125 INFO MainProcess] iteration:15000 speed:282.82 MLUPS
[ 9355 INFO MainProcess] iteration:16000 speed:281.31 MLUPS
[ 9590 INFO MainProcess] iteration:17000 speed:275.48 MLUPS
[ 9839 INFO MainProcess] iteration:18000 speed:260.35 MLUPS
[ 10076 INFO MainProcess] iteration:19000 speed:272.75 MLUPS
[ 10351 INFO MainProcess] iteration:20000 speed:235.59 MLUPS
[ 10625 INFO MainProcess] iteration:21000 speed:236.49 MLUPS
[ 11062 INFO MainProcess] iteration:22000 speed:148.00 MLUPS
[ 11284 INFO MainProcess] iteration:23000 speed:292.25 MLUPS
[ 11503 INFO MainProcess] iteration:24000 speed:295.61 MLUPS
[ 11764 INFO MainProcess] iteration:25000 speed:248.77 MLUPS
[ 12020 INFO MainProcess] iteration:26000 speed:252.55 MLUPS
[ 12274 INFO MainProcess] iteration:27000 speed:254.87 MLUPS
[ 12531 INFO MainProcess] iteration:28000 speed:252.07 MLUPS
[ 12779 INFO MainProcess] iteration:29000 speed:261.26 MLUPS
And this time I cannot cancel the job :-S
2a80b77 doesn't seem to quite fix it.
[kyle@desk01 examples]$ ./ldc_2d.py
[ 1883 INFO Master/desk01] Machine master starting with PID 4770
[ 1884 INFO Master/desk01] Handling subdomains: [0]
[ 1884 INFO Master/desk01] Subdomain -> GPU map: {0: 0}
[ 1951 INFO Subdomain/0] Initializing subdomain.
Process Subdomain/0:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(_self._args, *_self._kwargs)
File "/home/kyle/cfd/sailfish-cfd/sailfish/master.py", line 59, in _start_subdomain_runner
runner.run()
File "/home/kyle/cfd/sailfish-cfd/sailfish/subdomain_runner.py", line 1256, in run
self._sim.init_fields(self)
File "/home/kyle/cfd/sailfish-cfd/sailfish/lb_base.py", line 107, in init_fields
f = runner.make_scalar_field(name=field.name, async=True)
File "/home/kyle/cfd/sailfish-cfd/sailfish/subdomain_runner.py", line 243, in make_scalar_field
assert field.base is buf
(in reference to this comment to the Google group that should have been put here: https://groups.google.com/forum/?fromgroups=#!topic/sailfish-cfd/tbA5fhFCcMA)
I've just downloaded the project and ran some of the examples. Looks good!
I'm interested in figuring out if it's plausible to support message passing (MPI) in order to set up distributed simulations. I wasn't able to figure out any other way to get in touch with you other than opening an issue, so if there was a better medium within which this communication can take place let me know. =)
From my (limited) investigation of the docs and code, it seems like distributed simulation works by having two nodes that can connect to each other over the network. At our institution we have a supercomputer where nodes communicate via MPI. There is a python project to support MPI in this way (http://pympi.sourceforge.net/), but I wasn't sure what the best way to go about adding it to sailfish is.
Any thoughts?
Hello, seems the repo is not under maintain.
Here's a bug report, from python 3.10.
from sailfish.controller import LBSimulationController
File "F:\envs\lattuce-23071401\lib\site-packages\sailfish-2013.1-py3.10.egg\sailfish\controller.py", line 35, in <module>
from sailfish import codegen, config, io, util
File "F:\envs\lattuce-23071401\lib\site-packages\sailfish-2013.1-py3.10.egg\sailfish\codegen.py", line 16, in <module>
from sailfish.lb_base import LBMixIn
File "F:\envs\lattuce-23071401\lib\site-packages\sailfish-2013.1-py3.10.egg\sailfish\lb_base.py", line 4, in <module>
from sailfish import sym, util
File "F:\envs\lattuce-23071401\lib\site-packages\sailfish-2013.1-py3.10.egg\sailfish\sym.py", line 15, in <module>
from sailfish import sym_codegen
File "F:\envs\lattuce-23071401\lib\site-packages\sailfish-2013.1-py3.10.egg\sailfish\sym_codegen.py", line 11, in <module>
from sympy.printing.ccode import C99CodePrinter
ModuleNotFoundError: No module named 'sympy.printing.ccode'
Hi
I tried to run Sailfish on a Conda environment with the latest version of pyopencl, but it seems backend_opencl.py
use copy aliases. Checking the pyopencl repository I found that copy aliases were removed in v2018.2:
Copy aliases were replaced by the enqueue_copy
function.
It would be fine to update backend_opencl.py
or edit pyopencl version in setup.py
to pyopencl >= 2013.2, < 2018.2
.
The 'pressure' driving force option in 3d poiseuille example fails with and error because self.channel_length does not return a value. womersley is affected by bug because it inherites from poiseuille.
Dear Developers,
I am have been developing multiphysics open source project based on lattice Boltzmann method for pore scale simulation called Yantra and also made publications with it (https://www.researchgate.net/profile/Ravi_Patel31). We have a long term goal in maintaining Yantra along with providing training for the software. Last Novemeber one such training was organized.
Yantra uses layered approach which allows it to easily integrate with external solver. I have studied the code of salfish partly and I am very much interested in integrating Yantra with Salfish for gpu applications rather than developing new functionality from start. As Salfish is also written in python I can support seamless integration between two tools. However, looking at the state of repository and google forum I am not sure if this project is actively maintained or not. If not I am willing to volunteer to learn internals of salfish and help maintaining it along with Yantra. For further discussions my email address is [email protected]
best regards
Ravi
How to monitor the velocity along the center line of a cavity?
Dear sailfish Users and Developers!
I’ve been trying to simulate the particle deposition calculations on the human lung,The human trachea has a complex shape and tiny branches and I was wondering if this program could meet such a need.
Many thanks,
Guo Weiqi
ImportError: No module named skimage.morphology
ztdep@linux-9owh:~/Downloads/Sailfish/examples> sudo pip install scikit-image
Requirement already satisfied: scikit-image in /usr/lib64/python3.6/site-packages (0.17.2)
Requirement already satisfied: tifffile>=2019.7.26 in /usr/lib/python3.6/site-packages (from scikit-image) (2020.9.3)
Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/lib64/python3.6/site-packages (from scikit-image) (3.2.2)
Requirement already satisfied: scipy>=1.0.1 in /usr/lib64/python3.6/site-packages (from scikit-image) (1.2.0)
Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/lib64/python3.6/site-packages (from scikit-image) (5.0.0)
Requirement already satisfied: numpy>=1.15.1 in /usr/lib64/python3.6/site-packages (from scikit-image) (1.19.2)
Requirement already satisfied: imageio>=2.3.0 in /usr/lib/python3.6/site-packages (from scikit-image) (2.9.0)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/lib64/python3.6/site-packages (from scikit-image) (1.1.1)
Requirement already satisfied: networkx>=2.0 in /usr/lib/python3.6/site-packages (from scikit-image) (2.5)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image) (2.7.3)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib64/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image) (2.2.0)
Requirement already satisfied: decorator>=4.3.0 in /usr/lib/python3.6/site-packages (from networkx>=2.0->scikit-image) (4.4.2)
Requirement already satisfied: six>=1.5 in /usr/lib/python3.6/site-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image) (1.11.0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.