December 2019
Intermediate to advanced
346 pages
9h 8m
English
The following is a simple HelloWorld program that we can run using MPI. The program prints the processor number that the code is being executed on after a delay of two seconds. The same code can be run on multiple processors (we are able to specify the processor count).
Let's create a new console application project in Visual Studio and write the following code in the Program.cs file:
[DllImport("Kernel32.dll"), SuppressUnmanagedCodeSecurity]public static extern int GetCurrentProcessorNumber();static void Main(string[] args){ Thread.Sleep(2000); Console.WriteLine($"Hello {GetCurrentProcessorNumber()} Id");}
GetCurrentProcessorNumber() is a utility function that gives the processor number of where our code is being ...
Read now
Unlock full access