Question: Grid with numnodes option does not create files

I've been evaluating Grid but I found some problems with SQLite DB when not using numnodes.

So I am now using numnodes option to setup explicitly number of nodes to use with Grid.

But the problem is now print() do not show on the screen from node code. So hard to debug. So I changed code to send debug messages to print files.

But now I find that the files do even get created when using numnodes. 

When removing numnodes option, the text file gets created. 

I am using FileTools:-Text:-WriteString() and FileTools:-Text:-Close() in the node code.
I also tried using fopen(). Both do not work. 

Same code works OK if I do not use numnodes. 

Any idea why the file do not get created when using numnodes? Worksheet to produce this is below.

I use C:\\tmp folder for testing. Feel free to change this. When I run the code and look in the folder, I do not see the text file there when using numnodes. 

It is possible the file is created but saved somewhere else on the system even though the full file name is given?

It seems to me now that when using numnodes option, there are some things that work and some things that do not work. I do not know if this is by design or a bug. Any one knows?

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1843 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

Why task running on node do not create text file?

 

restart;

currentdir("C:\\TMP"): #change as needed

foo:=proc(n::integer)   
   local file_name::string;
   currentdir("C:\\TMP"): #change as needed
   file_name:=cat(currentdir(),"\\",n,"_file.txt");
   FileTools:-Text:-WriteString(file_name,cat("processing at node =",n));
   FileTools:-Text:-Close(file_name);
end proc:

Grid:-Set(foo):
Grid:-Setup("local",numnodes=1);
Grid:-Run(0,foo,[0]):
Grid:-Wait();

#No file "0_file.txt" is created in my C:\\TMP\ folder

 

 

 

Another version using fopen instead of FileTools. This also do not work

 

restart;

currentdir("C:\\TMP"): #change as needed

foo:=proc(n::integer)   
   local file_name::string, fileID;
   currentdir("C:\\TMP"): #change as needed
   file_name:=cat(currentdir(),"\\",n,"_file.txt");
   try
        fileID := fopen(file_name,WRITE);
    catch:
        error StringTools:-FormatMessage(lastexception[2..-1]);
    end try;   

   fprintf(fileID,"%s",cat("processing at node =",n));
   fclose(fileID);        
end proc:

Grid:-Set(foo):
Grid:-Setup("local",numnodes=1);
Grid:-Run(0,foo,[0]):
Grid:-Wait();


Download grid_question_jan_29_2025.mw

To see the file 0_file.txt get created in the folder, simply remove the numnodes option.

Please Wait...