A real time testing of pills during the production process is a challenging task and a promising approach has been investigated by Craig. C. Douglas et al. It relies on acoustic resonance spectroscopy in combination with smart sensors. In practice, only a limited number of frequencies can be used for the actual testing process and only the best frequencies should be used to ensure a correct identification. We present an algorithm which determines the suitability of a frequency tuple for the pill testing, depending on the pill's ingredients.Our algorithm relies on the minimization of a nonlinear functional for a best curve approximation of data in R^N in terms of orthogonal distance and linear regression. For the curve approximation we use polynomial curves as well as circular splines. Particularly, circular splines are interesting for the approximation, because closed formulas for the orthogonal distance projection can be derived and implemented easily. This is not true for polynomial curves, where we have to use iterative approximation. Despite of the fact, that the optimization functional is not sufficiently regular, we apply a Quasi-Newton method for the minimization. For the line search we use simple backtracking and a naive step size control. This is successful for most of the frequency tuples. If an optimization fails, the regarding frequency tuple gets purged.Evaluating one frequency tuple is a small problem, but in practice we have to evaluate many tuples for their identification ability. This is a very computational task. We could successfully apply GPUs for our algorithm and the implemented optimization algorithm yields a performance gain of about 250 for polynomial curves and about 20 for circular splines compared to one core of a recent CPU. A MPI-parallelization for multiple GPUs shows good speedup results.