Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Gastón Hillar

Dr. Dobb's Bloggers

Novell's Mono Brings SIMD Support to C#

April 07, 2009

Parallel programming is not just about multi-threading and multi-core. There's also a lot of power in the SIMD (Single Instruction Multiple Data) extended instruction set available in most modern microprocessors from Intel and AMD.Many applications written in C and C++ take advantage of these instruction sets to work on vectors and matrixes. They are very useful to improve performance in algorithms that need to perform multiple calculations on many data blocks. Many C and C++ compilers optimize loops to take advantage of SIMD instruction sets. Therefore, they are able to perform an automatic parallelization.

Nevertheless, .Net and C# developers working with managed code didn't have a simple way to take advantage of these powerful instruction sets in C# code. This scenario changes with the release of Mono 2.2 and the outstanding work done by Miguel De Icaza. Mono is an open source project, sponsored by Novell, which offers a multiplatform .Net development framework. However, it goes beyond this goal and, as a bonus, among other features, it offers access to hardware accelerated SIMD-based primitives. The key is the namespace Mono.Simd. Using it, you can take advantage of SIMD instruction sets in C#. It is a work in progress. Thus, it only supports up to SSE3 and some SSE4. However, it is a great improvement over the lack of support in C#.

Most operations for updating vectors and matrixes offer an incredible performance improvement and you don't have to leave C#.

It offers support for the following hardware accelerated packed types:

* Mono.Simd.Vector16b: 16 unsigned bytes. * Mono.Simd.Vector16sb: 16 signed bytes * Mono.Simd.Vector2d: 2 doubles * Mono.Simd.Vector2l: 2 signed 64-bit longs * Mono.Simd.Vector2ul: 2 unsigned 64-bit longs * Mono.Simd.Vector4f: 4 floats * Mono.Simd.Vector4i: 4 signed 32-bit ints * Mono.Simd.Vector4ui: 4 unsigned 32-bit ints * Mono.Simd.Vector8s: 8 signed 16-bit shorts * Mono.Simd.Vector8us: 8 unsigned 16-bit shorts

If you are interested in taking advantage of SIMD support offered in Mono, you can take a look at the excellent slide show presented by Miguel De Icaza at PDC 2008 here. You can find a further explanation of SIMD extensions in the article "I've Fallen In Love With the Vectoriser" written by Stephen Blair-Chappel, a few weeks ago. It uses C/C++, but you will be able to use C# with the Mono.Simd namespace.

You can check the kind of SIMD support that your current CPU offers using the freeware CPU-Z. It's an excellent utility to discover the different versions of SIMD available in a CPU.

If you work with vectors, matrixes and C#, you'll love the SIMD support that Mono offers.

For more details, go here

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.