Grid

Matrix-Matrix Multiplication MPI C Source Code

Expanding from my previous post, “Matrix-Vector Multiplication MPI C Source Code”. Now we create a program to calculate two two-dimensional matrices (array) with MPI. Same concept and algorithm with matrix-vector used to solve this problem, row-based operation.

Now the differences from matrix-vector just the array size and dimension.

#define AROW 3
#define ACOL 2

#define BCOL 3

#define MAX_VALUE 10

For proc_map() function please look at matrix-vector post, and here’s the computational code for matrix-matrix multiplication.

Read More →

Hello World MPI C Source Code

Got something interesting, MPI (Message Passing Interface) is the language or library which needed to create parallel programming. So let’s start with the usual way to begin code, “Hello World”. This post will be show how to make the simplest MPI code in C language.

#include "stdio.h"
#include "mpi.h"
 
int main(int argc, char** argv)
{
    int rank;
    int size;
 
    /* Initialize MPI  */
    MPI_Init(&argc, &argv);
 
    /* Getting the World Size and Process Number (rank) */
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 
    /* Routine for process 0 */
    if (rank == 0)
    {
        printf("P%d : I Found this world size is %d processesn", rank, size);
        printf("P%d : Hello World! This is process number %d writing!n", rank, rank);
    }
    /* Routine for process 1 */
    else if (rank == 1)
    {
        printf("P%d : I Found this world size is %d processesn", rank, size);
        printf("P%d : Hello World! This is process number %d writing!n", rank, rank);
    }
    /* Routine for Other Processes */
    else
    {
        printf("P%d : I'm Unused Process...n", rank);
    }
 
    /* End of MPI */
    MPI_Finalize();
    return 0;
}

Read More →

DataGridView DataSource C# Source Code

How to fill DataGridView items on c# if we’re connect using OleDbConnection?

We’re gonna use DataSet for filling the DataGridView.. Here’is the example…

The information about variables and objects used is

  1. dataGridView1 –> DataGridView GUI Object from Toolbox
  2. Program.con –> OleDbConnection (using System.Data.OleDb)
  3. combo_produk_id –> ComboBox GUI Object from Toolbox
        private void Item_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            DataSet ds = new DataSet();

            Program.con.Open();
            
            OleDbCommand cmd = Program.con.CreateCommand();
            cmd.CommandText = "SELECT * FROM produk";

            OleDbDataReader reader = cmd.ExecuteReader();
            combo_produk_id.Items.Clear();
            while (reader.Read())
            {
                combo_produk_id.Items.Add(reader.GetValue(0));
            }

            Program.con.Close();

            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(ds);
            
            dataGridView1.DataSource = ds.Tables[0];
            
        }