Closed JeanYvesJonet closed 3 years ago
Hello I think the problem is in TNeuralTHread, TNeuralThread.Create. The name of the event is not unique accross several instances running. The name should contain a random number or a program instance number or a PID or ... to make it unique, and then, it should run fine. You could, for example, add the application.handle to the name of the event. It would make the trick.
Thank you for the bug report. I'll look into it.
Hello,
From the documentation, I can read the following :
System.SyncObjs.TEvent.Create
Instantiates a TEvent object to represent an event object.
Call Create to create a TEvent object. Create can generate a new event object or can provide access to an existing named event object. ... Set Name to provide a name for a new event object or to specify an existing named event object. If no other thread or process will need to access the event object to wait for its signal, Name can be left blank. Name can be a string of up to 260 characters, not including the backslash character (). If Name is used to specify an existing event object, the value must match the name of the existing event in a case-sensitive comparison. If Name matches the name of an existing semaphore, mutex, or file-mapping object, the TEvent object will be created with Handle set to 0 and all method calls will fail.
As far as I can undestand from windows API, the name is shared accross the entire operating system. I would replace these 2 lines
FNeuronStart := TEvent.Create(nil, True, False, 'NStart '+IntToStr(pIndex)) ; FNeuronFinish := TEvent.Create(nil, True, False, 'NFinish '+IntToStr(pIndex)) ;
by FNeuronStart := TEvent.Create(nil, True, False, 'NStart '+IntToStr(Application.Handle)+IntToStr(pIndex)) ; FNeuronFinish := TEvent.Create(nil, True, False, 'NFinish '+IntToStr(Application.Handle)+IntToStr(pIndex)) ;
and give it a try. I think, if my assumption is correct, that it should do the trick.
@HuguesDug , sounds like a very good idea! I'll give it a go.
@HuguesDug, your solution works. Thank you very much.
Always happy to help with debugging with great lib.
@HuguesDug, fantastic!
Besides the problem you've reported, it also happens with FPC on Windows for another reason. If 2 processes share the same output file, neuralfit crashes.
I did this to avoid the problem at SimpleImageClassifier example:
NeuralFit.FileNameBase := 'SimpleImageClassifier-'+IntToStr(GetProcessId());
Hello, I did a software to learn with pair lists (delphi 10.3) . It's work fine. But if i run the software several times (>=2), to start several learning at the same time, nothing more happens. Software doesn't do anything anymore, they occupy 0% of the CPU. I need to kill all process. It's the same problem with or without CUDA OpenCL. Only one at the same time ! Do you know this problem ? Thanks