473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using vector units

Hi,

Many processors have some kind of facility for working on multiple data
at once (MMX, SIMD, SSE2, Altivec, Velocity Engine, etc). What's the
state of the art with regards trying to use these with C/C++? How does
one present data to the compiler so that the compiler might be able to
invoke the vector unit?
Jul 23 '05 #1
3 1380
Richard Cavell wrote:
Many processors have some kind of facility for working on multiple data
at once (MMX, SIMD, SSE2, Altivec, Velocity Engine, etc). What's the
state of the art with regards trying to use these with C/C++? How does
one present data to the compiler so that the compiler might be able to
invoke the vector unit?


AFAIK, the only facility that comes close to bridging the gap between the
language and the CPU in that matter is 'std::valarray'. The library is
free to implement any operations on it using the vector facility in the
hardware.

Then again, I've never used that template, so I wouldn't really know...

V
Jul 23 '05 #2

"Richard Cavell" <ri***********@mail.com> wrote in message
news:d0**********@nnrp.waia.asn.au...
Hi,

Many processors have some kind of facility for working on multiple data at
once (MMX, SIMD, SSE2, Altivec, Velocity Engine, etc). What's the state
of the art with regards trying to use these with C/C++? How does one
present data to the compiler so that the compiler might be able to invoke
the vector unit?


I'm not sure what you mean bvy a "vector unit"...? Are you referring to
multiple processors on one computer? If so, the OS takes care of when/if
those are used, usually. But if you write code that uses threads, then the
computer is likely to make use of both processors when two threads are
running concurrently.

However, hardware issues and threads are not topical to this newsgroup,
which discusses C++ language issues (since standard C++ does not specify
anything (at least not yet) about threading models). I don't know if
there's a newsgroup that does discuss general multi-processor questions, but
you could search on groups.google.com, or find a newsgroup that discusses
the particular OS or hardware you're interested in.

-Howard
Jul 23 '05 #3
Richard Cavell wrote:
Hi,

Many processors have some kind of facility for working on multiple
data at once (MMX, SIMD, SSE2, Altivec, Velocity Engine, etc).
What's the state of the art with regards trying to use these with
C/C++? How does one present data to the compiler so that the
compiler might be able to invoke the vector unit?


Some compilers do attempt vectorization, but the results I've seen have
been rather underwhelming (on the order of 10-20%). A fair number of
compilers include intrinsics so you can include the vector instructions
directly into C++. These generally require you to use special key words
for the data types.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Karen | last post by:
Hi, I have one constant variable and want to use it in two files. I put it in the header file and then include the header file. The compiler always say "error C2370: 'arraysize' : redefinition;...
7
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using...
19
by: becte | last post by:
I need to use three bytes to store four 6-bit integers (4 * 6 = 3 * 8) like this 11111122|22223333|33444444 Suppose the input is, int c1, c2, c3, c4, range 0 .. 2^6 -1 and the output is int...
6
by: johannblake | last post by:
I am wondering whether it is easy to setup a coordinate system for drawing (using GDI+) that uses meters (or any custom scaling for that matter). Currently, I need to convert from pixels to meters...
5
by: Javaman59 | last post by:
I just saw an interesting identifier in a C# book I'm reading... double dollarsPerHead This jumped out at me, as it is not common to put units in an identifer. We don't see...
5
by: JoeC | last post by:
I have a vector of elements, how can I take the first element of a vector and put it in the end and have all the other elements cycle down? Ex: 1, 2, 3, 4... cycle 4, 1, 2 ,3
5
by: sjsn | last post by:
Basic C++, just started this course in school... So I'm very limited. What I'm at doing is, below I have a variable named inputTemp, which is the product of a char, F = Fahrenheit, C = Celsius...
4
by: Dia | last post by:
Hi there, I struggle to get this going i would like to insert data into 2 tmp tables in a view. If i run the code on it's own it works perfectly until i want to create a view it complains...
0
by: rupak | last post by:
I am using the xml file as given below <?xml version="1.0"?> <propertyfolio> <property_group description="abc"> <property ref="1" name="One"> <unit id="2147365895" /> ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.