How do I disable/configure macOS Sierra's auto throttling of the CPU for processor intensive tasks
Here are a few broad steps from a post on "Disable OS X kernel_task throttling" which you will need to try since I don't have an iMac on hand. Strongly suggest you read the post in detail and also understand potential risks before executing this sequence.


Disable System Integrity Protection so you can make system folder edits with steps at
How do I disable System Integrity Protection (SIP) AKA “rootless” on OS X 10.11, El Capitan?
Boot into single-user mode with Command-S sequence
Mount the filesystem:
fsck -y; mount -uw / 
Backup the IOPlatformPluginFamily.kext extension
rsync -av /System/Library/Extensions/IOPlatformPluginFamily.kext /Users/Shared/
now delete the IOPlatformPluginFamily.kext extension and restart
rm -rf /System/Library/Extensions/IOPlatformPluginFamily.kext; shutdown -r now


If/when you want to restore the configuration,
rsync -av /Users/Shared/IOPlatformPluginFamily.kext /System/Library/Extensions

The /Users/Shared/ location for storing extension is a subjective choice. You can backup in any other safe place (even on an external drive). As long as you can retrieve it when you want to rollback this action.