Best choices for AMD 3970x when compiling from source

When compiling from source there are various environment variables that can be set. For instance, there are various architecture options, thread counts, etcetera. What are the optimal choices for these for an AMD 3970x machine on Linux? (32 CPUs / 64 threads)