Open main menu

CDOT Wiki β

Changes

GPU621/Group 5

3,739 bytes added, 16:02, 9 April 2023
MPI
== MPI ==
MPIis a compiler, not a library so we’ll have to work with it differently, you’ll need to download MPI by using homebrew. Simply follow these steps: <li value=1> Open your terminal </li>2. Update your homebrew using the following command:  brew update  Install open-mpi using the following  brew install open-mpi 1. You can see if it was successfully installed by using :2. the installation is complete, the **`mpirun`** and **`mpic++`** should return `**/usr/local/bin/**`   which mpicc // for mpi c compiler which mpic++ // for mpi c++ which mpirun // Building a MPI executable  ===tasks.json===  { "tasks": [ ... { "label": "C/C++ using MPI: mpic++ build active file", // Task label we'll reference in launch "type": "cppbuild", "command": "/usr/local/bin/mpic++", // Use the mpic++ command to build our files "args": [ // Arguments to run our tasks "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": ["$gcc"] } ... ] } === launch.json ===  { "version": "0.2.0", "configurations": [ ... { "name": "C/C++ using MPI: mpic++ run active file", // Task name we'll use to identify the task "type": "cppdbg", "request": "launch", "program": "/usr/local/bin/mpirun", // MPI files uses mpirun "args": [ "-np", // Flag identifies the that we want to configure the number of processes we want to run "4", // Number of processes "${fileDirname}/${fileBasenameNoExtension}", // Path to active file ], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, // Use an external console "MIMode": "lldb", "preLaunchTask": "C/C++ using MPI: mpic++ build active file" } ... ] }  === c_cpp_properties.json === We only need to add to the '''includePath''' array, not to the '''configurations array'''  { "configurations": [ { "name": "Mac", "includePath": [ // Adding these wouldn't detriment any of your code "${workspaceFolder}/**", // Adds all files within our Current workspace to the Included files "/usr/local/Cellar/libomp/15.0.7/include", // Adds all files within the libomp workspace to the Included files "/opt/intel/oneapi/tbb/2021.8.0/include", // Adds all files within the tbb workspace to the Included files "/usr/local/include" // Adds the directory where the mpi Include data are ], "defines": [], "macFrameworkPath": [ "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/g++", "cStandard": "c11", // Standard we're using "intelliSenseMode": "macos-clang-x64" } ], "version": 4 }
== Testing ==