Page 1 of 1

Multiple V-REP instances running on same computer conflict, cannot have lua scripts write to files from latter instance

Posted: 16 Nov 2019, 22:35
by RobAtLab
I've tried running separate V-REP sims in parallel on the same (linux) computer. I find that even if two separate copies folders are used for V-REP_PRO_EDU_V3_X_Linux for each sim to run in, hence two separate terminal windows launched, one in each folder, then weird behaviours occur between the two running sims. It seems that only one of the sims is able to make use of writing to files from a lua script within a child script, using syntax such as:

if(outFileName ~= nil) then
timestampedPrint("Opening log file ("..outFileName..")", 1)
outFile = io.open(outFileName, "w")
timestampedPrint("Writing log data", 1)
outFile:write(outString)
timestampedPrint("Flushing data", 1)
outFile:flush()
timestampedPrint("Closing log file", 1)
outFile:close(outFile)
timestampedPrint("File closed", 1)
end

specifically whichever copy is launched first can write out correctly, the other just doesn't write out to file at all.

And also only the copy of V-REP which is launched first is able to use sim.stopSimulation() to stop the program. When each V-REP sim has been launched using a command line such as ./vrep.sh -g70.5 '/home/robert/Downloads/V-REP_PRO_EDU_V3_5_0_Linux/scenes/file.ttt' -s900000 -q then only one of the sims closes V-REP when it ends either. I need to make these multiple runs to gather statistical data from simulations, and if multiple sims can run at once I can parallelise my work and put each instance of V-REP on a separate CPU core to run things much faster. But right now running two sims on the same computer at once is impossible as one of them gets denied the ability to write to file and to close itself. Any suggestion as to what is going on here? This has been done with V-REP 3.5 at present because later versions refuse to run on the many cored machine which I have access to (the many cored machine isn't running ubuntu and isn't one I can change the OS of, it runs centOS but with just a few special packages added it can handle V-REP 3.5 just fine but won't run either the ubuntu16 or 18 version of V-REP 3.6.2 .

I wondered if file access and self-closing of sims might have been handled by V-REP writing to a file NOT in V-REP's own folder, perhaps something in a home, root, lua interpreter related or hidden directory of the linux OS, and hence both copies of V-REP try to access this same file as some sort of "flag" for which of them is allowed to do file writing and closing at present? maybe having a conflict with one another when both instances try to access the same file which is in neither of the V-REP directories.

I don't know if for systems which can handle V-REP 3.6.2 this multiple instance bug might have been fixed already. Thank You

Re: Multiple V-REP instances running on same computer conflict, cannot have lua scripts write to files from latter insta

Posted: 18 Nov 2019, 14:48
by coppelia
Hello,

there is nothing in the source code that relates to an absolute file path on Ubuntu. Practically, all write accesses from V-REP/CoppeliaSim are within the installation folder. Some folder paths can be changed in the settings file (in system/usrset.txt).

We'll have to run some tests here...

Cheers