# MPI Templates

To ease with common patterns of MPI programming, code templates are provided for a small number of patterns. More can be easily added.

This allows quick entry of common patterns in MPI programming.

For example, for MPI send-receive,

- Edit a C source code file in the CDT editor.
- Enter: `mpisr` and hit Ctrl-space
  Note: On Mac, you may need to hit Ctrl-space twice.
- Select the template you want (mpisr is probably the only one) and hit Enter. This expands to the following:

Type over any of the included sample variable names, and all occurrences of that name within the template code will be changed accordingly.

One other pattern is also included. Type `mpiif` and hit Ctrl-space to see initialize and finalize API calls.

To see the code templates, and add your own:

- Bring up Eclipse preferences (Windows/Linux: Window > Preferences; Mac: Eclipse > Preferences)
- Open C/C++, Editor, Templates
<lp> </lp>
- The sample for MPI Send Receive is shown. You can add your own or modify any you like.

If you have ideas for more MPI (or other) templates, please consider contributing these to PTP! Send email to ptp-dev@eclipse.org (Developer mailing list).

Back to Top | Back to Table of Contents