Changes

Jump to: navigation, search

GPU621/Group 5

6,963 bytes added, 23:56, 9 April 2023
no edit summary
== Final Note ==
Congratulations! You’ve successfully started your journey working in a parallel environment on Mac. While the fundamentals are here, it’s not the entire picture, you may run into problems that were not covered here. For example to change the optimization level, you can use these flags:
 
# for no optimization
# for slight optimization
# for lots of optimization
 
Google is your friend, but when you’re lost here are some great resources:
 
=== General G++ ===
 
[https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/](https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/)
 
=== OpenMP: ===
 
[https://gcc.gnu.org/projects/gomp/#usage](https://gcc.gnu.org/projects/gomp/#usage)
 
=== TBB: ===
 
[https://oneapi-src.github.io/oneTBB/](https://oneapi-src.github.io/oneTBB/)
 
=== MPI: ===
 
[https://www.open-mpi.org/doc/current/man1/mpic++.1.php](https://www.open-mpi.org/doc/current/man1/mpic++.1.php)
 
[https://www.open-mpi.org/doc/current/man1/mpirun.1.php](https://www.open-mpi.org/doc/current/man1/mpirun.1.php)
 
=== File Directory System: ===
{
--> .vscode
| \-> launch.json
| \-> task.json
| \-> c_cpp_properties.json
--> ws1
--> ws2
--> ws3
--> ...
--> /* Your other folders of assignments and files
}
 
=== Final tasks.json: ===
{
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++ using OpenMP: g++ build active file", // Task label we'll reference in launch
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-Xpreprocessor", // Identifies we are setting options for preprocessing
"-fopenmp", // Preprocessor is set to use OpenMP
"-I/usr/local/Cellar/libomp/15.0.7/include", // OpenMP include directory path
"-L/usr/local/Cellar/libomp/15.0.7/lib", // OpenMP library directory path
"-lomp", // added this
"-std=c++11", // C++ language standard to follow
"-g", // Enables debugging information
"${file}", // Active file being compiled
"-o", // Output file
"${fileDirname}/${fileBasenameNoExtension}" // Output file path
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": "build",
"detail": "Task generated by User"
},
{
"type": "cppbuild",
"label": "C/C++ using TBB: g++ build active file", // Task label we'll reference in launch
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-I/opt/intel/oneapi/tbb/2021.8.0/include", // tbb include directory path
"-L/opt/intel/oneapi/tbb/2021.8.0/lib", // tbb library directory path
"-Wl,-rpath,/opt/intel/oneapi/tbb/2021.8.0/lib", // Dynamically Link the .../lib directory to the executable
"-ltbb", // Preprocessor is set to use tbb
"-std=c++11", // C++ language standard to follow
"-g", // Enables debugging information
"${file}", // Active file being compiled
"-o", // Output file
"${fileDirname}/${fileBasenameNoExtension}" // Output file path
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": "build",
"detail": "Task generated by User"
},
{
"type": "cppbuild",
"label": "C/C++ using MPI: mpic++ build active file", // Task label we'll reference in launch
"command": "/usr/local/bin/mpic++", // Use the mpic++ command to build our files
"args": [
// Arguments to run our tasks
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": "build",
"detail": "Task generated by User"
}
]
}
}
 
=== Final launch.json ===
{
{
"configurations": [
{
"name": "Custom C/C++: g++ build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension} ",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: g++ build active file"
},
{
"name": "Build and Debug WS2",
"type": "cppdbg",
"request": "launch",
"program": "/Users/ibrahim/Desktop/Winter 2023/GPU621/ws2/ws2",
"args": ["100000000"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: g++ build WS2 file"
},
{
"name": "Build and Debug WS5",
"type": "cppdbg",
"request": "launch",
"program": "/Users/ibrahim/Desktop/Winter 2023/GPU621/ws5/w5",
"args": ["100000000"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: g++ build WS5 file"
},
{
"name": "MPI Debug",
"type": "cppdbg",
"request": "launch",
"program": "/usr/local/bin/mpirun",
"args": [
"-np",
"4",
"${fileDirname}/${fileBasenameNoExtension}",
"1000000"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"setupCommands": [],
"preLaunchTask": "build mpi"
}
],
"version": "2.0.0"
}
}
 
=== Final c_cpp_properties.json ===
{
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/Cellar/libomp/15.0.7/include",
"/opt/intel/oneapi/tbb/2021.8.0/include",
"/usr/local/include"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}
}
== References ==
24
edits

Navigation menu