Any hit program

I am new to OPTIX.
I want to use it for ray tracing on triangular mesh.
Each triangle in the mesh is opaque (i.e. the ray is perfectly reflected).
Also I want to allow up to 6 secondary rays (i.e. bounces).
For this case does the any hit program is mandatory or the closest hit program suffice?

You do not need an anyhit program for a ray type which only needs to handle the closest hits of opaque objects.
The default anyhit is a no-operation which means you automatically get the closest hit when that ray type traverses the scene.

More explanations here:

As OptiX beginner please have a look at the OptiX introduction presentation and example sources.
Links here:
The fourth example already does what you’re asking for and it’s getting better from there.