tags:

views:

41

answers:

1

Hi,

I am new to OSX and mac. I have some old number crunching programs. I wonder what are the best approaches in OSX to

1) find the bottlenecks in the program. I read that the best is to use Xcode and profiling tools, but this is not clear to me which one of this tools is the best one

2) once the bottlneck is found, what is the best approach to change the smallest possible part of the code and translate it into opencl equivalent, so one gets a decent overall speedup. I guess there is a lot of approaches here, just wanted to hear from you what is the best place to start from

Thanks

A: 

For (1), I would start with Shark, if only because it's by far the simplest tool to use. Just launch Shark, point it at your program, and click the button to collect samples. It will give you pretty good sampling data that should show you what routines (or stretches of code) are the bottlenecks. You may find it helpful to build your programs with debug info -g, as it can make the Shark traces a bit easier to read.

For (2), without knowing more about what you're doing, it's impossible to know if OpenCL is suitable for your problem or not. Find the bottlenecks first, then think about how to solve them. Don't get locked into the idea of using one technology or another before you know what you'd be using it for.

Stephen Canon