Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions check/user.frm
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,52 @@ Print check;
.end
assert result("check") =~ expr("0")
*--#] jodavies_prf_1 :
*--#[ jodavies_dollar_locks :
#-

#: TermsInSmall 2M

* A larger version of this test can be used to easily demonstrate the
* performance improvement due to max/min dollar locking changes in TFORM,
* see PR 807.

Symbol x,i;
CFunction sum;

#define N "{32*8}"
*#define BLOCK "200000"
#define BLOCK "20"

Local test =
#do i = 0,{`N'-1}
+ sum(i,`i'*`BLOCK',{`i'+1}*`BLOCK'-1,x^i)
#enddo
;
.sort
Identify sum(?a) = sum_(?a);
.sort

#$min = `N'*`BLOCK';
#$max = -1;

If (Count(x,1) > $max) $max = count_(x,1);
If (Count(x,1) < $min) $min = count_(x,1);

ModuleOption maximum $max;
ModuleOption minimum $min;
.sort

#message max: `$max'
#message min: `$min'
.end
assert succeeded?
assert stdout =~ exact_pattern(<<'EOF')
~~~max: 5119
EOF
assert stdout =~ exact_pattern(<<'EOF')
~~~min: 0
EOF
*--#] jodavies_dollar_locks :
*--#[ tueda_prf_1 :
#-
Off Statistics;
Expand Down
38 changes: 22 additions & 16 deletions doc/manual/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3164,30 +3164,36 @@ \section{moduleoption}
\leftvitem{3.5cm}{local\index{moduleoption!local}}
\rightvitem{13cm}{Should be followed by a list of \$-variables. Indicates
that the contents of the indicated \$-variables\index{\$-variable} are not
relevant once the module has been finished and neither is the term by term
order in which the \$-variables obtain their value. In practise each
relevant once the module has been finished, and neither is the term by term
order in which the \$-variables obtain their value. In practice each
processor\index{processor}/thread\index{thread} will work with its own copy
of this variable.}

\leftvitem{3.5cm}{maximum\index{moduleoption!maximum}}
\rightvitem{13cm}{Should be followed by a list of
\$-variables\index{\$-variable}. Indicates that of the contents of the
indicated \$-variables the maximum is the only thing that is relevant once
the module has been finished. The term by term order in which the
\$-variables obtain their value is not relevant.}
\rightvitem{13cm}{Should be followed by a list of \$-variables\index{\$-variable}.
Indicates that only the maximum value of the \$-variables is relevant once the
module has finished. The term-by-term order in which the \$-variables obtain
their value is not relevant. In practice each processor\index{processor}/thread
\index{thread} will work with its own copy of the variable, and the
maximal value is kept at the end of term processing. The variables should
contain numbers only.}

\leftvitem{3.5cm}{minimum\index{moduleoption!minimum}}
\rightvitem{13cm}{Should be followed by a list of
\$-variables\index{\$-variable}. Indicates that of the contents of the
indicated \$-variables the minimum is the only thing that is relevant once
the module has been finished. The term by term order in which the
\$-variables obtain their value is not relevant.}
\rightvitem{13cm}{Should be followed by a list of \$-variables\index{\$-variable}.
Indicates that only the minimum value of the \$-variables is relevant once the
module has finished. The term-by-term order in which the \$-variables obtain
their value is not relevant. In practice each processor\index{processor}/thread
\index{thread} will work with its own copy of the variable, and the
minimal value is kept at the end of term processing. The variables should contain
numbers only.}

\leftvitem{3.5cm}{sum\index{moduleoption!sum}}
\rightvitem{13cm}{Should be followed by a list of
\$-variables\index{\$-variable}. Indicates that the indicated \$-variables
are representing a sum. The term by term order in which the \$-variables
obtain their value is not relevant.}
\rightvitem{13cm}{Should be followed by a list of \$-variables\index{\$-variable}.
Indicates that the specified \$-variables represent a sum. The term-by-term
order in which the \$-variables obtain their value is not relevant.
In practice, this is a global dollar variable for which all parallel read and
write accesses are protected by locks. The variables should contain numbers
only.}

\noindent The options `local', `maximum', `minimum' and `sum' are for
parallel versions of \FORM\@. The presence of \$-variables can be a problem
Expand Down
1 change: 1 addition & 0 deletions sources/declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ extern WORD *MakeDollarInteger(PHEAD WORD *,WORD **);
extern WORD *MakeDollarMod(PHEAD WORD *,WORD **);
extern int GetDolNum(PHEAD WORD *, WORD *);
extern void AddPotModdollar(WORD);
extern int DollarLocalCopy(WORD);

extern int Optimize(WORD, int);
extern int ClearOptimize(void);
Expand Down
Loading
Loading