  We use highly resolved numerical simulations to study turbulent
Rayleigh-B\'enard convection in a cell with sinusoidally rough upper and lower
surfaces in two dimensions for $Pr = 1$ and $Ra = \left[4 \times 10^6, 3 \times
10^9\right]$. By varying the wavelength $\lambda$ at a fixed amplitude, we find
an optimal wavelength $\lambda_{\text{opt}}$ for which the Nusselt-Rayleigh
scaling relation is $\left(Nu-1 \propto Ra^{0.483}\right)$ maximizing the heat
flux. This is consistent with the upper bound of Goluskin and Doering
\cite{Goluskin:2016} who prove that $Nu$ can grow no faster than ${\cal O}
(Ra^{1/2})$ as $Ra \rightarrow \infty$, and thus the concept that roughness
facilitates the attainment of the so-called ultimate regime. Our data nearly
achieve the largest growth rate permitted by the bound. When $\lambda \ll
\lambda_{\text{opt}}$ and $\lambda \gg \lambda_{\text{opt}}$, the planar case
is recovered, demonstrating how controlling the wall geometry manipulates the
interaction between the boundary layers and the core flow. Finally, for each
$Ra$ we choose the maximum $Nu$ among all $\lambda$, and thus optimizing over
all $\lambda$, to find $Nu_{\text{opt}} - 1 = 0.01 \times Ra^{0.444}$.
