Is there any way to select a gpu for a program under Ubuntu?

My computer has multiple graphics cards, and I want to specify a gpu for my program for OpenGL rendering. Could someone tell me how I should do this? I have searched this question, but found nothing is helpful. The api WGL_NV_gpu_affinity seems to work only under Windows and only support Quadro.