This answer is taken from the CEC. Table 17 states minimum size of grounding conductors. For a service conductor drawing 400 amps a #3 copper grounding conductor is needed. Also see rules 10-206, 10-700 and 10-812 if you have access to the code book.
Use #10 copper.
# 10 bare copper.
#6 bare copper wire.
The ground wire should go from the dryer directly back to the distribution panel. An external ground wire is not required. The ground wire that is in the cord set that is connected to the frame of the dryer and the ground wire that is in the feeders coming from the distribution panel, that is connected to the ground terminal in the dryer receptacle, is all that is required to satisfy the code requirement.
If the sub panel is in the same building remove the bonding screw that bonds the neutral bar to the panels enclosure. Remove the ground from the second ground rod. The sub panel is grounded by the ground wire from the sub panel's feeder. If the panel is separate from the main building treat the sub panel as a separate service. It will need its own ground rods and ground wire from the rods to the neutral bar of the sub panel. Leave the bonding screw in. There will be no ground wire in the conduit between the two services.
The recommended ground wire size for a 100 amp sub panel installation is typically 8 copper wire.
Use #10 copper.
# 10 bare copper.
The size of the ground wire for a circuit is typically based on the size of the circuit breaker protecting that circuit. For a 200 amp circuit breaker, the recommended ground wire size is 4/0 AWG (American Wire Gauge) copper wire. This wire size helps ensure that the ground wire can safely carry any fault currents that may occur in the electrical system.
#6 bare copper wire.
In a 200 amp service panel, the ground wire is typically a bare copper wire or green insulated wire. It is connected to the ground bar within the panel. Make sure to consult the manufacturer's instructions or a licensed electrician for guidance specific to your installation.
The recommended ground wire size according to the NEC Ground Wire Size Chart is based on the amperage of the circuit.
#8 would be fine if you ground each panel separately to the ground rod
The sub panel wire size chart provides information on the recommended wire size based on the amperage of the sub panel, the distance the wire needs to run, and the type of wire insulation. This helps determine the appropriate wire size for a sub panel installation to ensure safety and efficiency.
The ground wire size is determined from the current carrying capacity of the motor feeders.
The ground wire should come from the ground rod and to the main electrical panel grounding terminal.
The size of wire needed for a sub panel installation depends on the amperage of the sub panel. It is recommended to consult with a licensed electrician to determine the appropriate wire size for your specific installation.