×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Is C good for prallel programming and graphics?

Is C good for prallel programming and graphics?

Is C good for prallel programming and graphics?

(OP)
  I wanted to embark on making some visual physics software that will run on many cores and was wondering if c was good, and if so, what compilers will be best for it? Also, are there any tips that someone might be able to give me?

RE: Is C good for prallel programming and graphics?

I'd rather use C++ since it doesn't require as much low level things to worry about and can do a lot of things for your automatically.  C is better for things like device drivers.

RE: Is C good for prallel programming and graphics?

C and C++ have no built-in graphics libraries, so you'll have to go to a third-party source for that.  If you compile for more than one OS family, you'll have to have a separate library for each one, and write the graphics function calls based on which OS you're compiling for.

Lee

RE: Is C good for prallel programming and graphics?

(OP)
I want to run it solely on a Unix (or perhaps Linux) operating system. The project is mostly something for me to test my metal (and it's something I'm very interested in). My decision to do so came from advice that I received in order to avoid a "deadly embrace" when I'm allocating memory. Anyways, if anyone knows some good graphics libraries, and/or libraries to assist with parallel programming, I'd appreciate it.

RE: Is C good for prallel programming and graphics?

If you want to run on the most different platforms, and speed isn't the most important factor, I would suggest looking into Java. You'll get to your version 1.0 a lot faster than in C, and it will run almost the same on all platforms.

Probably not a popular suggestion in a C forum, but it's pretty much true. Especially if you are asking this question, you're probably pretty early in your C learning curve. So on that too, I think Java is a better choice.

 

RE: Is C good for prallel programming and graphics?

(OP)
The thing is, time isn't much of an issue. I was thinking of making this into my senior design project (as an EE major), and I'm a sophomore in college. So right now, I just finished with my intro to C class (ending with my knowledge on structures) and I'm going to be starting my some CS courses that are required for electrical engineering. So I'd like to make a basic program in C and then slowly improve on it. Once I get all the techniques worked out, then I can start implementing it onto a integrated circuit. C is mostly my best choice since I haven't worked in Java, VB, or c++ in years now. That, and I can get my professors to help me since they're quite proficient in C. So I guess I should have changed the title to: "need libraries and tips" for parallel programming and graphics.

RE: Is C good for prallel programming and graphics?

To use per-core parallelism, you need library that supports threading. I recommend SDL:

http://www.libsdl.org/

It is widely used free cross-platform C library that (besides lots of other things) also provides threading and graphics support (native 2D and opengl 3D)

For low-level parallelisation you would have to resort to assembly language - SIMD instructions (MMX,SSE...).
 

RE: Is C good for prallel programming and graphics?

There are lots of C++ libraries which will do graphics on multiple platforms eg Fox, FLTK, WxWidgets.  Haven't seen any in C.  Websites for Fox and FLTK appear to have more questions than answers, so you may be on your own there.

For *nix, X Windows, Motif etc is in C but the books and experts to answer any questions are really difficult to get hold of.  I don't know about KDE or Gnome.  Qt is C++.

As for parallelism, you're depending on the vendor's API for that processor.  Some are scalable, some are not.  Again, there are very few experts in these areas.  Most people just do it at the start of the project and that is it.  If you ask them about it, they'll probably tell you they haven't seen the code since they last debugged it.  It is normally the case of "if it works, don't touch it".  Debugging parallelism can be quite difficult.  You have to be able to tell all processors to stop or wait while you debug one of them.

Make sure you can debug before you venture into those areas.

RE: Is C good for prallel programming and graphics?

(OP)
Any suggestions for the best IDE to use?

RE: Is C good for prallel programming and graphics?

(OP)
I just took a look at using SDL on pelles c. Is that one of the better choices, or is there a preferable alternative? It looks good so far

RE: Is C good for prallel programming and graphics?

All IDEs have their own ideosyncracies.  There is no best.  If you like it, it is best.  If you don't like it, even though the rest of the world thinks it is best, you'll think it is crap.

What platform are you working on?

RE: Is C good for prallel programming and graphics?

(OP)
I'm currently using windows xp (too lazy to get partitioning software and burning a disk to get linux). I heard that Linux is the best to run SDL on. Anyways I'm quite pleased with the SDL library (just need to learn how to use it effectively). Also thanks for the help. If an admin reads this, please close the thread.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close