Skip to content

Instantly share code, notes, and snippets.

@iwatake2222
Created October 21, 2017 03:36
Show Gist options
  • Save iwatake2222/ef5d2b146a9e0d88a931400cef60a337 to your computer and use it in GitHub Desktop.
Save iwatake2222/ef5d2b146a9e0d88a931400cef60a337 to your computer and use it in GitHub Desktop.
OpenMP sample for Visual Studio
#include "stdafx.h"
#include "omp.h"
/*
* DO NOT FORGET TO ENABLE OPEN MP
* right click on project -> Properties -> C/C++ -> Language
* Open MP Support = Yes
*/
int main()
{
#pragma omp parallel for
for (int y = 0; y < 10; y++) {
for (int x = 0; x < 10; x++) {
printf("%d %d %d\n", omp_get_thread_num(), x, y);
}
}
while (1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment