Add cuda support for xptemplate.