Batch-processing Visio diagrams

Started by Nikolay, August 24, 2015, 11:30:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikolay

Hi guys, encountered the following thing. Not sure what I miss.

I have Core i7 CPU (8 cores).

I try to run 4 instances of Visio (EXE) at the same time, to process 4 different batches of diagrams.
For simplicity, just assume that "processing" is opening and then closing a diagram.

Now what puzzles me.
I expected the processing speed to be about 4x times more if I run 4 Visio executables at the same time on machine with 4 cpus. But.
The processing speed is almost the same as with 1 Visio instance. I.e. if you run 4 Visios, they preform almost 4x times slower..?

Why can that be? Am I missing something simple?
It looks like Visio.exe block all other Visio.exe instances on the same machine on opening a file (locks some global mutex?). Can it be?

My file setup - nothing fancy.. A batch file, "run.bat":


start cscript test1.vbs
start cscript test2.vbs
start cscript test3.vbs
start cscript test4.vbs


"textN.vbs" file(s) - only file lists are different:

Set app = CreateObject("Visio.InvisibleApp")

path = "....."

Sub Process(s)
Set doc = app.Documents.Open(path & s)
WScript.Echo doc.Name
doc.Close
End Sub

Process "0d59f842-e7ae-44e2-8dc4-857c9073f781.vsd"
Process "0dff240d-9377-477f-8e42-6778d9b62366.vsd"

.... many more of those ....

Process "546AA373-96BD-4F86-9286-44970801EC1F.vsd"

app.Quit

wapperdude

Hi Nikolay,

Is it possible that the cpu clock speed is dividing down, so, 4 CPUs get roughly,  1/4 clock rate?

Wapperdude
Visio 2019 Pro

Nikolay

#2
I think that's not possible.
If I run other programs "4 in a row", they normally run at the same speed as a single one. That's what CPUs are for, anyways, or?

I'm becoming more and more convinced that Visio is blocking some global os-wide lock/mutex on opening diagram, or something like that
(so that only one visio instance can be in "opening a file" state at one point of time). Not sure why.

The thing is, I need to (automatically) process A LOT of diagrams (like hundreds / thousands)..
The idea was that if one could take advantage of modern multiple-core CPUs do that in multiple processes, this could significantly reduce the processing time.
But for some reason that possibility appears to be blocked.. why? ???

Now I'm trying to dig in in with WinObj and ProcessExplorer to figure out why Visio seems to process all in a "single-thread" manner..

For example: Even if you create two Visio applications like this:


Set app1 = CreateObject("Visio.Application")
Set app2 = CreateObject("Visio.Application")

Set doc1 = app1.Documents.Add("")
Set doc2 = app2.Documents.Add("")

WScript.Echo doc1.Name
WScript.Echo doc2.Name


the name of "doc1" will be "Drawing1" and the name of "doc2" will be "Drawing2" which means that there is some interaction between app1 and app2.
Basically, I don't want any interaction. I want app1 and app2 run completely independently.

wapperdude

Ah!  My dear Watson!!!  The solution is obvious!   ::)  You don't need a single machine with multiple processors...you need multiple machines with single processors each.  Brilliant!

...and the masked cowboy rode slowly off into the sunset.   8)

Well, that's as much help as I can offer.

Wapperdude
Visio 2019 Pro

CoreFusion

Have you checked your cpu utilization while doing the batches? Is the load distributed evenly across the different cpus or is all the load on the first one? (performance tab in windows task manager). Not sure how affinity is set when you spawn multiple visio processes...