Comments (6)
Hi @gp37,
UW has a built in function to reduce values to root. You can try the following:
import underworld.function as fn
### reduce x, y and temperatureField to root proc
x = fn.input()[0].evaluate_global(mesh.data)
y = fn.input()[1].evaluate_global(mesh.data)
T = temperatureField.evaluate_global(mesh.data)
### print the sum of the temperatureField
if rank == 0:
print(np.sum(T))
from underworld2.
Thanks Ben,
I tried to implement the code above and I don't get any errors, however, the code seems to take a long time to run or is getting stuck in a loop or something. For example, I ran the above code for 5 minutes and still, I was not able to finish evaluating for x. This is true on multiple processors and just running in serial. Is this normal for the evaluate_global function?
from underworld2.
Giving an update, I actually get this error when running x = fn.input()[0].evaluate_global(mesh.data)
File "/opt/venv/lib/python3.10/site-packages/underworld/function/_function.py", line 744, in evaluate_global
total_output[incoming_positions] = incoming_data
IndexError: index 6633 is out of bounds for axis 0 with size 6633
Abort(1) on node 0 (rank 0 in comm 496): application called MPI_Abort(comm=0x84000002, 1) - process 0
and I am not sure how to fix that.
from underworld2.
Hi @gp37, can you share the entire block of code? It looks like you're trying to update an array in certain locations, but the incoming data should contain the entire array (if using the code above).
The evaluate_global does take a while unfortunately, we could use MPI routines but the evaluate_global is much more straight forward to use
from underworld2.
Hi,
Attached is a script with a simple mantle convection model in which I cannot get evaluate_global to work.
MantleConvectionParallel.ipynb.zip
from underworld2.
Hi @gp37, I've had a look and come up with the following using MPI:
### on local nodes
x = np.ascontiguousarray(mesh.data[:,0])
y = np.ascontiguousarray(mesh.data[:,1])
T = np.ascontiguousarray(temperatureField.data[:,0])
### Collect local array sizes using the high-level mpi4py gather
sendcounts = np.array(comm.gather(len(x), root=0))
if rank == 0:
### creates dummy data on all nodes to store the data that is gathered
x_data = np.zeros((sum(sendcounts)), dtype='float64')
y_data = np.zeros((sum(sendcounts)), dtype='float64')
T_data = np.zeros((sum(sendcounts)), dtype='float64')
else:
x_data = None
y_data = None
T_data = None
comm.barrier()
### gather data on root proc (0)
comm.Gatherv(sendbuf=x, recvbuf=(x_data, sendcounts), root=0)
comm.Gatherv(sendbuf=y, recvbuf=(y_data, sendcounts), root=0)
comm.Gatherv(sendbuf=T, recvbuf=(T_data, sendcounts), root=0)
if rank == 0:
'''do some stuff'''
print(x_data.shape)
Let me know how it goes
from underworld2.
Related Issues (20)
- HDF5: infinite loop error on Setonix (using singularity/3.8.6-mpi) HOT 5
- Melt in UWGeodyanmics Heat Eq. HOT 1
- About Material participation movement problem HOT 3
- How to set an elevation with a height variation in coupling model of uwGeodynamics and badlands HOT 2
- RuntimeError: There were left over keyword arguments. kwargs = [{'_fn_fssa': None}]
- communication between the UW2 model and the Badlands surface processes model
- UWGeodynamics velocitySurface_2D Bug HOT 1
- Coupled Evolution of Deformation, Pore Fluid Pressure, and Fluid Flow in the thrust-fold mountain belt ? HOT 4
- Uncoupled temperature and compositional field in UW Geodynamics HOT 2
- Adding two plasticities to one material HOT 3
- SystemError: <built-in function SystemLinearEquations_UpdateSolutionOntoNodes> returned a result with an exception set HOT 1
- Parallel computing and An installation problem (MpiRun) HOT 4
- 'surface' integration HOT 2
- Model.mesh.deform_mesh() error with mpirun. Possibly two nodes are in an identical location.
- Installation error HOT 11
- Compressible mantle convection with tala approximation HOT 1
- A question about strata results from coupled model HOT 3
- May I ask how is the second-order invariant of strain rate(function: fn.tensor.second_invariant)in underworld2.13 calculated?
- Question about using mesh.specialSets['MinI_VertexSet'] as a boundary index with parallel run
- Converging issue for 3D subduction model with oblique trench shape. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from underworld2.