Preheat oven to 350°F and line the bottoms of three 8-inch round cake pans or one 9x13-inch baking pan. Spray the pan(s) with cooking spray and, if desired, lightly cover the insides with coarse raw sugar.
In a large bowl, whisk together flour, cinnamon, nutmeg, cloves, ginger, allspice, salt, and baking soda; set aside.
2½ cups self-rising flour, 1½ teaspoons ground cinnamon, ½ teaspoon ground nutmeg, ½ teaspoon ground cloves, ½ teaspoon ground ginger, ¼ teaspoon ground allspice, 1 teaspoon kosher salt, 1 teaspoon baking soda
In the bowl of a stand mixer fitted with the paddle attachment, mix the granulated sugar and brown sugar together on low speed. Add the oil and vanilla and beat on medium speed until well incorporated, about 1 minute. Add the eggs, one at a time, mixing well after each addition.
1½ cups granulated sugar, ½ cup dark brown sugar, 1 cup vegetable oil, 1 tablespoon pure vanilla extract, 4 large eggs
Set mixer to low and add the flour in ½ cup increments.
Fold in the carrots, pineapple and, if using, nuts.
3 cups grated carrots, ½ cup crushed pineapple, 1 cup chopped toasted pecans
Divide the batter evenly between the 3 cake pans (about 536 grams per pan) or spread in the 9x13.
Bake, on the middle rack, for 30-40 minutes or until a toothpick inserted in the center comes out clean. The internal temperature in the middle of each cake layer should register 200°F-205°F on an instant-read thermometer.
Transfer cakes to a wire rack and cool in the pans for 10 minutes. Remove cakes from pans and return to cooling racks to cool completely.