We present Vobla, a domain-specific language designed for programming linear algebra libraries. Vobla is compiled to Pencil, a domain independent intermediate language designed for efficient mapping to accelerator architectures such as GPGPUs. Pencil is compiled to efficient, platform-specific OpenCL code using techniques based on the polyhedral model. This approach addresses both the programmer productivity and performance portability concerns associated with accelerator programming. We demonstrate our approach by using Vobla to implement a BLAS library. We have evaluated the performance of OpenCL code generated using our compilation flow on ARM Mali, AMD Radeon, and AMD Opteron platforms. The generated code is currently on average 1.9× slower than highly hand-optimized OpenCL code, but on average 8.1× faster than straightforward OpenCL code. Given that the Vobla coding takes significantly less effort compared to hand-optimizing OpenCL code, we believe our approach leads to improved productivity and performance portability.