X can be any intrinsic Fortran data type: integer, real, double precision, complex, logical or, character. It can be a scaler or an array. If X is an array then it must be the same size for all tasks. Also, if x is an array, the entire array will be broadcast.
|
[ccm_host:~/ccm/source]% ccm_bcast_x1
time difference from the root process = 0.000000
root and my time 10:48:32.286 10:48:32.286
time difference from the root process = -0.054
root and my time 10:48:32.286 10:48:32.340
time difference from the root process = -101.406
root and my time 10:48:32.286 10:50:13.691
time difference from the root process = -7.31641
root and my time 10:48:32.286 10:48:39.602
[ccm_host:~/ccm/source] %
The call to ccm_init initializes the communication package. The time is then obtained and converted to a real value, local_time and then copied to global_time. The root task broadcasts global_time to all other tasks. All tasks now have the global_time from task zero. Each task prints the difference between global_time and local_time. The root task then broadcasts its time_info_array to the other tasks. All tasks then print the time_info_array and values for hours, minutes, seconds, and milliseconds. The call to ccm_close closes the communication package. |
|
[ccm_home:~/ccm/source] % ccm_bcast_x2
root id= 2 my id= 0
root id= 2 my id= 2
root id= 2 my id= 1
root id= 2 my id= 3
[ccm_home:~/ccm/source] %
The call to ccm_init initializes the communication package. The 2 elements of the array ids are set to the task id, 0-3. The root task is set to 2 and ccm_bcast is called to send 1 value from the array ids. Each task gets a single value that replaces the first element of ids. The two elements of ids are printed, the root task id and "myid". The call to ccm_close closes the communication package. |