We have implemented a generic method, based on the 2n+1 theorem within density functional perturbation theory, to calculate the anharmonic scattering coefficients among three phonons with arbitrary wavevectors. The method is used to study the phonon broadening in graphite and graphene mono- and bi-layer. The broadening of the high-energy optical branches is highly nonuniform and presents a series of sudden steps and spikes. At finite temperature, the two linearly dispersive acoustic branches TA and LA of graphene have nonzero broadening for small wavevectors. The broadening in graphite and bi-layer graphene is, overall, very similar to the graphene one, the most remarkable feature being the broadening of the quasi acoustical ZO branch. Finally, we study the intrinsic anharmonic contribution to the thermal conductivity of the three systems, within the single mode relaxation time approximation. We find the conductance to be in good agreement with experimental data for the out-of-plane direction but to underestimate it by a factor 2 in-plane.