Click here to Skip to main content
15,884,821 members
Articles / Programming Languages / C#

Multicore Speedup Analysis using Jacobi Relaxation Running on Multiple Threads

Rate me:
Please Sign up or sign in to vote.
3.18/5 (8 votes)
10 Jul 2007CPOL3 min read 38.9K   220   16  
Analyse the speedup achieved by multicore processors by running a computation intensive task, using multithreading to create 1 separate thread per processor.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Jacobi_RedBlack.CustomControls
{
    public partial class Grid : UserControl
    {
        public Grid()
        {
            InitializeComponent();
            for (int x = 0; x < Constants.gridCellsPerRow; x++)
            {
                for (int y = 0; y < Constants.gridCellsPerCol; y++)
                {
                    gridCell[x, y] = new CustomControls.GridCell();
                    if (x == 0 || x == Constants.gridCellsPerRow - 1 || y == 0 || y == Constants.gridCellsPerCol-1)
                    {
                        this.groupBox.Controls.Add(this.gridCell[x, y]);
                        this.gridCell[x, y].Size = new System.Drawing.Size(26, 20);
                        this.gridCell[x, y].TabIndex = x + y;
                        this.gridCell[x, y].Location = new System.Drawing.Point(x * Constants.gridCellOffsetMul + Constants.gridCellOffsetAdd, y * Constants.gridCellOffsetMul + Constants.gridCellOffsetAdd);

                        if ((y > 0 && x == 0 && y < Constants.gridCellsPerCol - 1) || (y > 0 && x == Constants.gridCellsPerRow - 1 && y < Constants.gridCellsPerCol - 1))
                        {
                            this.gridCell[x, y].CellValue.Text = "0";
                        }
                    }
                }
            }
        }

        private void gridCell3_Load(object sender, EventArgs e)
        {

        }

        private void gridCell00_Load(object sender, EventArgs e)
        {

        }


     }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Sri Lanka Sri Lanka
coding in C# C++ C

==============================================

Code in English, not Gibberish Smile | :)

Comments and Discussions