Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit on parallel sim arguments #90

Open
sturlaan opened this issue Apr 14, 2021 · 1 comment
Open

Limit on parallel sim arguments #90

sturlaan opened this issue Apr 14, 2021 · 1 comment

Comments

@sturlaan
Copy link

The expression list in the "parallel sim" command seems to be limited in the number of arguments it can take.
From what I can tell, the limit changes somewhat between system and version. (tested on both 2-core win 10 stata15 MP2 and 96-core Linux server using stata16.1 MP4)

setting exp_arguments to above 2000 (1938 on this system) will work fine with the standard stata simulate command, but not with "parallel sim". Parallel returns the r(198) error and terminates the parallel processes:

Parallel Computing with Stata
Child processes: 2
pll_id         : 9kkln2bq67
Running at     : C:\Users\sal\Documents
Randtype       : datetime
Waiting for the child processes to finish...
child process 0001 Exited with error -198- while running the command/dofile (view log)...
child process 0002 Exited with error -198- while running the command/dofile (view log)...
--------------------------------------------------------------------------------
Enter -parallel printlog #- to checkout logfiles.
--------------------------------------------------------------------------------
2 child processes encountered errors. Throwing last error.
r(198); t=2.41 13:39:54

The code below reproduces the error on both systems I have access to. By setting the local exp_arguments lower (example 1000) means both simulate and parallel sim will execute w/o any issues.

**********************
clear all
version 15
local exp_arguments = 2000 

cap program drop test1
program define test1, rclass 
 clear
 set matsize 10000
 set obs 1000 
 g x = rnormal()
 forv i=1/10000 {
  sum x if runiform()<.1, meanonly
  return scalar r`i' = r(mean)
 }
end

// Generate list of arguments
local list1 ""
 forv i=1/`exp_arguments' { 
  local list1 = "`list1'  r`i' = r(r`i')"
 }
 
simulate `list1' , reps(10): test1 
parallel setclusters 2
parallel sim, expr(`list1') reps(10): test1
***********************

System information

Parallel version:

parallel Stata module for parallel computing
vers 1.20.0 19mar2019
auth George G. Vega [cre,aut], Brian Quistorff [aut]

System values:

c(stata_version)	=	15
c(version)	=	15	(version)
c(userversion)	=	15	(version)
c(dyndoc_version)	=	1	(dyndoc)
				
c(flavor)	=	"IC"
c(bit)	=	64
c(SE)	=	1
c(MP)	=	1
c(processors)	=	2	(Stata/MP, set	processors)
c(processors_lic)	=	2
c(processors_mach)	=	4
c(processors_max)	=	2

c(os)	=	"Windows"
c(osdtl)	=	"64-bit"

System limits
c(max_N_theory)	=	1099511627775
c(max_k_theory)	=	5000	(set maxvar)
c(max_width_theory)	=	1048576	(set maxvar)
			
c(max_matsize)	=	11000
c(min_matsize)	=	10
				
c(max_macrolen)	=	15480200
c(macrolen)	=	645200	(set maxvar)
c(charlen)	=	67783
c(max_cmdlen)	=	15480216
c(cmdlen)	=	645216	(set maxvar)
c(namelenbyte)	=	128
c(namelenchar)	=	32
c(eqlen)	=	1337
@gvegayon
Copy link
Owner

Not sure how to help here. I just tried your code using Stata 16.1 on Unix and neither simulate nor parallel sim work for me:

Here is my output:

. clear all

. version 15

. local exp_arguments = 2000 

. 
. cap program drop test1

. program define test1, rclass 
  1.  clear
  2.  set matsize 10000
  3.  set obs 1000 
  4.  g x = rnormal()
  5.  forv i=1/10000 {
  6.   sum x if runiform()<.1, meanonly
  7.   return scalar r`i' = r(mean)
  8.  }
  9. end

. local list1 ""

.  forv i=1/`exp_arguments' { 
  2.   local list1 = "`list1'  r`i' = r(r`i')"
  3.  }

.  
. simulate `list1' , reps(10): test1 
matsize must be between 10 and 800
an error occurred when simulate executed test1
r(198);
System values
-------------

    -----------------------------------------------------------------------------------------
        c(current_date) = "12 Jun 2021"
        c(current_time) = "15:56:37"
           c(rmsg_time) = 0                          (seconds, from set rmsg)
    -----------------------------------------------------------------------------------------
       c(stata_version) = 16.1
             c(version) = 15                         (version)
         c(userversion) = 15                         (version)
      c(dyndoc_version) = 2                          (dyndoc)
    -----------------------------------------------------------------------------------------
           c(born_date) = "01 Sep 2020"
              c(flavor) = "IC"
                 c(bit) = 64
                  c(SE) = 0
                  c(MP) = 0
          c(processors) = 1                          (Stata/MP, set processors)
      c(processors_lic) = 1
     c(processors_mach) = .
      c(processors_max) = 1
                c(mode) = ""
             c(console) = "console"
    -----------------------------------------------------------------------------------------
                  c(os) = "Unix"
               c(osdtl) = ""
            c(hostname) = **************
        c(machine_type) = "PC (64-bit x86-64)"
           c(byteorder) = "lohi"
            c(username) = **************
    -----------------------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants