Question: 3) Alternative: write a program to model a cellular automaton (see links above on cellular automata). The grid should be at least 600x600, the neighborhood

3) Alternative: write a program to model a cellular automaton (see links above on cellular automata). The grid should be at least 600x600, the neighborhood around each cell should be variable, allowing radius from 1 (3x3 square) to at least 3 (7x7 square centered on a cell).

Notes on parallelizing cellular automata

Here is how to compile and link programs that combine MPI and CUDA code. In the example, the cuda code is "cuda.cu" and the mpi code is "mpi.c". The final executable is "cudaMPI"

nvcc -c cuda.cu // Makes cuda.o mpicc -c mpi.c // Makes mpi.o mpicc mpi.o cuda.o -o cudaMPI -lcudart -L /usr/local/cuda/lib64 ==> makes cudaMPI. Execute with mpirun or mpiexec, like a standard mpi program. With thanks to Ahmed Algadi, who figured out this sequence of instructions and in particular the library specifications.

Programming note: if programming in C or in C++, output from different processes may appear out of order, even if the processes are ordered, due to buffered standard output. When using printf to standard output, follow it with "fflush(stdio);" to force the buffers to empty. In C++, almays terminate COUT statements with "endl" Only do this if output order from multiple processes is important, because it slows things down.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!