我得到的似乎是Encog(3.x)线程/工作负载错误......
在两台服务器上使用Encog CS 3.1,3.2和3.3与VS.NET 2015,每台服务器都配备双X5400系列4核/ 4线程Xeon(总共8核/ 8线程系统),没有任何问题。一个拥有32Gb RAM而另一个拥有64Gb(虽然我实际上只看到一个忙线,但那是另一个故事......)。
我最近在双X7500系列8核/ 16线程Xeon服务器(总共16核/ 32线程64Gb系统)上尝试了完全相同的代码,编译(exe)和VS IDE,我得到了这个错误( Encog CS直接从GitHub预编译DLL:
System.OverflowException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Arithmetic operation resulted in an overflow. at Encog.Util.Concurrency.DetermineWorkload..ctor(Int32 threads, Int32 workloadSize)
at Encog.Neural.Networks.Training.Propagation.Propagation.Init()
at Encog.Neural.Networks.Training.Propagation.Propagation.CalculateGradients()
at Encog.Neural.Networks.Training.Propagation.Propagation.ProcessPureBatch()
at Encog.Neural.Networks.Training.Propagation.Propagation.Iteration()
at EncogConsole.modEncog.ElmanTypeA(Boolean boolErrorVerbose, Boolean boolTestOutput) in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\NormalizedConsole_v4B\EncogConsole\modEncog.vb:line 126
at EncogConsole.modEncog.Main() in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\NormalizedConsole_v4B\EncogConsole\modEncog.vb:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()System.OverflowException: Arithmetic operation resulted in an overflow.
at Encog.Util.Concurrency.DetermineWorkload..ctor(Int32 threads, Int32 workloadSize)
at Encog.Neural.Networks.Training.Propagation.Propagation.Init()
at Encog.Neural.Networks.Training.Propagation.Propagation.CalculateGradients()
at Encog.Neural.Networks.Training.Propagation.Propagation.ProcessPureBatch()
at Encog.Neural.Networks.Training.Propagation.Propagation.Iteration()
at EncogConsole.modEncog.ElmanTypeA(Boolean boolErrorVerbose, Boolean boolTestOutput) in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\NormalizedConsole_v4B\EncogConsole\modEncog.vb:line 126
at EncogConsole.modEncog.Main() in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\NormalizedConsole_v4B\EncogConsole\modEncog.vb:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart() 0.31s
这里的问题是代码完全相同,具有完全相同的数据集等。尝试了在前两个X5400服务器上正常运行的不同代码(尽管似乎是单个线程)仍然是同样的问题(在X7500服务器上)。所有使用最新补丁等运行W2K8R2的机器
代码是用VB完成的,但如前所述,工作正常,除了这个更高线程数的服务器。
是什么给出了?
答案 0 :(得分:0)
建议使用:
var num =(int)Environment.ProcessorCount;
而不是:
var num =(int)(Math.Log(((int)Process.GetCurrentProcess()。ProcessorAffinity + 1),2));
获取处理器(线程)计数:
Encog.Util.Concurrency.DetermineWorkload> public DetermineWorkload(int threads,int workloadSize)
as var num =(int)(Math.Log(((int)Process.GetCurrentProcess()。ProcessorAffinity + 1),2));对于双CPU,32线程系统返回4294967295,而Environment.ProcessorCount正确返回32。