Instant download (Ebook) MATLAB Parallel Computing Toolbox™ User's Guide by The MathWorks, Inc. pdf all chapter
Instant download (Ebook) MATLAB Parallel Computing Toolbox™ User's Guide by The MathWorks, Inc. pdf all chapter
com
https://ebooknice.com/product/matlab-parallel-computing-
toolboxtm-user-s-guide-11236254
DOWLOAD EBOOK
https://ebooknice.com/product/matlab-econometrics-toolboxtm-user-s-
guide-11236174
ebooknice.com
https://ebooknice.com/product/matlab-bioinformatics-toolboxtm-user-s-
guide-11236232
ebooknice.com
https://ebooknice.com/product/matlab-mapping-toolboxtm-user-s-
guide-11236250
ebooknice.com
https://ebooknice.com/product/matlab-optimization-toolboxtm-user-s-
guide-11236252
ebooknice.com
(Ebook) Deep Learning Toolbox Getting Started Guide -
MATLAB by The MathWorks, Inc.
https://ebooknice.com/product/deep-learning-toolbox-getting-started-
guide-matlab-43710832
ebooknice.com
https://ebooknice.com/product/matlab-computer-vision-toolboxtm-user-s-
guide-11236240
ebooknice.com
https://ebooknice.com/product/matlab-curve-fitting-toolboxtm-user-s-
guide-11236242
ebooknice.com
https://ebooknice.com/product/matlab-fuzzy-logic-toolboxtm-user-s-
guide-11236244
ebooknice.com
https://ebooknice.com/product/matlab-global-optimization-toolboxtm-
user-s-guide-11236246
ebooknice.com
Parallel Computing Toolbox™
User's Guide
R2020a
How to Contact MathWorks
Phone: 508-647-7000
Getting Started
1
Parallel Computing Toolbox Product Description . . . . . . . . . . . . . . . . . . . . 1-2
v
Parallel for-Loops (parfor)
2
Decide When to Use parfor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
parfor-Loops in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Deciding When to Use parfor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Example of parfor With Low Parallel Overhead . . . . . . . . . . . . . . . . . . . . . 2-3
Example of parfor With High Parallel Overhead . . . . . . . . . . . . . . . . . . . . 2-4
vi Contents
Temporary Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
Uninitialized Temporaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
Temporary Variables Intended as Reduction Variables . . . . . . . . . . . . . . . 2-49
ans Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49
vii
Load Distributed Arrays in Parallel Using datastore . . . . . . . . . . . . . . . . 3-10
Alternative Methods for Creating Distributed and Codistributed Arrays . 3-12
Programming Overview
5
How Parallel Computing Products Run a Job . . . . . . . . . . . . . . . . . . . . . . . 5-2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Toolbox and Server Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Life Cycle of a Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
viii Contents
Apply Callbacks to MATLAB Job Scheduler Jobs and Tasks . . . . . . . . . . . 5-21
ix
Program Independent Jobs
6
Program Independent Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
GPU Computing
8
GPU Capabilities and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Performance Benchmarking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
x Contents
Establish Arrays on a GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Create GPU Arrays from Existing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Create GPU Arrays Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Examine gpuArray Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Save and Load gpuArrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
xi
Objects
9
Functions
10
xii Contents
1
Getting Started
Parallel Computing Toolbox lets you solve computationally and data-intensive problems using
multicore processors, GPUs, and computer clusters. High-level constructs—parallel for-loops, special
array types, and parallelized numerical algorithms—enable you to parallelize MATLAB® applications
without CUDA or MPI programming. The toolbox lets you use parallel-enabled functions in MATLAB
and other toolboxes. You can use the toolbox with Simulink® to run multiple simulations of a model in
parallel. Programs and models can run in both interactive and batch modes.
The toolbox lets you use the full processing power of multicore desktops by executing applications on
workers (MATLAB computational engines) that run locally. Without changing the code, you can run
the same applications on clusters or clouds (using MATLAB Parallel Server™). You can also use the
toolbox with MATLAB Parallel Server to execute matrix calculations that are too large to fit into the
memory of a single machine.
1-2
Parallel Computing Support in MathWorks Products
Most MathWorks products enable you to run applications in parallel. For example, Simulink models
can run simultaneously in parallel, as described in “Run Multiple Simulations” (Simulink). MATLAB
Compiler™ and MATLAB Compiler SDK™ software let you build and deploy parallel applications; for
example, see the “Parallel Computing” section of MATLAB Compiler “Standalone Applications”
(MATLAB Compiler).
Several MathWorks products now offer built-in support for the parallel computing products, without
requiring extra coding. For the current list of these products and their parallel functionality, see:
https://www.mathworks.com/products/parallel-computing/parallel-support.html
1-3
1 Getting Started
In this section...
“Creating Distributed Arrays” on page 1-4
“Creating Codistributed Arrays” on page 1-5
If your data is currently in the memory of your local machine, you can use the distributed function
to distribute an existing array from the client workspace to the workers of a parallel pool.
Distributed arrays use the combined memory of multiple workers in a parallel pool to store the
elements of an array. For alternative ways of partitioning data, see “Distributing Arrays to Parallel
Workers” on page 3-10.You can use distributed arrays to scale up your big data computation.
Consider distributed arrays when you have access to a cluster, as you can combine the memory of
multiple machines in your cluster.
A distributed array is a single variable, split over multiple workers in your parallel pool. You can
work with this variable as one single entity, without having to worry about its distributed nature.
Explore the functionalities available for distributed arrays in the Parallel Computing Toolbox:
“Run MATLAB Functions with Distributed Arrays” on page 4-19.
When you create a distributed array, you cannot control the details of the distribution. On the
other hand, codistributed arrays allow you to control all aspects of distribution, including
dimensions and partitions. In the following, you learn how to create both distributed and
codistributed arrays.
• Use the distributed function to distribute an existing array from the client workspace to the
workers of a parallel pool.
• You can directly construct a distributed array on the workers. You do not need to first create the
array in the client, so that client workspace memory requirements are reduced. The functions
available include eye(___,'distributed'), rand(___,'distributed'), etc. For a full list,
see the distributed object reference page.
• Create a codistributed array inside an spmd statement, see “Single Program Multiple Data
(spmd)” on page 1-12. Then access it as a distributed array outside the spmd statement. This
lets you use distribution schemes other than the default.
In this example, you create an array in the client workspace, then turn it into a distributed array:
You have createdB as a distributed array, split over the workers in your parallel pool. This is
shown in the figure.
1-4
Create and Use Distributed Arrays
• “Partitioning a Larger Array” on page 4-6 — Start with a large array that is replicated on all
workers, and partition it so that the pieces are distributed across the workers. This is most useful
when you have sufficient memory to store the initial replicated array.
• “Building from Smaller Arrays” on page 4-6 — Start with smaller replicated arrays stored on
each worker, and combine them so that each array becomes a segment of a larger codistributed
array. This method reduces memory requirements as it lets you build a codistributed array from
smaller pieces.
• “Using MATLAB Constructor Functions” on page 4-7 — Use any of the MATLAB constructor
functions like rand or zeros with a codistributor object argument. These functions offer a quick
means of constructing a codistributed array of any size in just one step.
In this example, you create a codistributed array inside an spmd statement, using a nondefault
distribution scheme. First, define 1-D distribution along the third dimension, with 4 parts on worker
1, and 12 parts on worker 2. Then create a 3-by-3-by-16 array of zeros.
For more details on codistributed arrays, see “Working with Codistributed Arrays” on page 4-4.
See Also
Related Examples
• “Distributing Arrays to Parallel Workers” on page 3-10
• “Big Data Workflow Using Tall Arrays and Datastores” on page 5-46
• “Single Program Multiple Data (spmd)” on page 1-12
1-5
1 Getting Started
ver
When you enter this command, MATLAB displays information about the version of MATLAB you are
running, including a list of all toolboxes installed on your system and their version numbers.
If you want to run your applications on a cluster, see your system administrator to verify that the
version of Parallel Computing Toolbox you are using is the same as the version of MATLAB Parallel
Server installed on your cluster.
1-6
Interactively Run a Loop in Parallel Using parfor
This example calculates the spectral radius of a matrix and converts a for-loop into a parfor-loop.
Find out how to measure the resulting speedup.
1 In the MATLAB Editor, enter the following for-loop. Add tic and toc to measure the time
elapsed.
tic
n = 200;
A = 500;
a = zeros(n);
for i = 1:n
a(i) = max(abs(eig(rand(A))));
end
toc
2 Run the script, and note the elapsed time.
Elapsed time is 31.935373 seconds.
3 In the script, replace the for-loop with a parfor-loop.
tic
n = 200;
A = 500;
a = zeros(n);
parfor i = 1:n
a(i) = max(abs(eig(rand(A))));
end
toc
4 Run the new script, and run it again. Note that the first run is slower than the second run,
because the parallel pool takes some time to start and make the code available to the workers.
Note the elapsed time for the second run.
By default, MATLAB automatically opens a parallel pool of workers on your local machine.
Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers.
...
Elapsed time is 10.760068 seconds.
1-7
1 Getting Started
The parfor run on four workers is about three times faster than the corresponding for-loop
run. The speed-up is smaller than the ideal speed-up of a factor of four on four workers. This is
due to parallel overhead, including the time required to transfer data from the client to the
workers and back. This example shows a good speed-up with relatively small parallel overhead,
and benefits from conversion into a parfor-loop. Not all for-loop iterations can be turned into
faster parfor-loops. To learn more, see “Decide When to Use parfor” on page 2-2.
One key requirement for using parfor-loops is that the individual iterations must be independent.
Independent problems suitable for parfor processing include Monte Carlo simulations and
parameter sweeps. For next steps, see “Convert for-Loops Into parfor-Loops” on page 2-7.
In this example, you managed to speed up the calculation by converting the for-loop into a parfor-
loop on four workers. You might reduce the elapsed time further by increasing the number of workers
in your parallel pool, see “Scale Up parfor-Loops to Cluster and Cloud” on page 2-21.
You can modify your cluster profiles to control how many workers run your loops, and whether the
workers are local or on a cluster. For more information on profiles, see “Discover Clusters and Use
Cluster Profiles” on page 5-11.
Modify your parallel preferences to control whether a parallel pool is created automatically, and how
long it remains available before timing out. For more information on preferences, see “Specify Your
Parallel Preferences” on page 5-9.
You can run Simulink models in parallel with the parsim command instead of using parfor-loops.
For more information and examples of using Simulink in parallel, see “Run Multiple Simulations”
(Simulink).
See Also
parfor | parpool | tic | toc
More About
• “Decide When to Use parfor” on page 2-2
• “Convert for-Loops Into parfor-Loops” on page 2-7
• “Scale Up parfor-Loops to Cluster and Cloud” on page 2-21
1-8
Run Batch Parallel Jobs
5 batch does not block MATLAB and you can continue working while computations take place. If
you need to block MATLAB until the job finishes, use the wait function on the job object.
wait(job)
6 After the job finishes, you can retrieve and view its results. The load command transfers
variables created on the worker to the client workspace, where you can view the results:
load(job,'A')
plot(A)
7 When the job is complete, permanently delete its data and remove its reference from the
workspace:
delete(job)
clear job
batch runs your code on a local worker or a cluster worker, but does not require a parallel pool.
You can use batch to run either scripts or functions. For more details, see the batch reference page.
1-9
1 Getting Started
parfor i = 1:1024
A(i) = sin(i*2*pi/1024);
end
3 Save the file and close the Editor.
4 Run the script in MATLAB with the batch command. Indicate that the script should use a
parallel pool for the loop:
job = batch('mywave','Pool',3)
This command specifies that three workers (in addition to the one running the batch script) are
to evaluate the loop iterations. Therefore, this example uses a total of four local workers,
including the one worker running the batch script. Altogether, there are five MATLAB sessions
involved, as shown in the following diagram.
wait(job)
load(job,'A')
plot(A)
The results look the same as before, however, there are two important differences in execution:
• The work of defining the parfor-loop and accumulating its results are offloaded to another
MATLAB session by batch.
• The loop iterations are distributed from one MATLAB worker to another set of workers
running simultaneously ('Pool' and parfor), so the loop might run faster than having only
one worker execute it.
6 When the job is complete, permanently delete its data and remove its reference from the
workspace:
delete(job)
clear job
1-10
Run Batch Parallel Jobs
Running a script as a batch from the browser uses only one worker from the cluster. So even if the
script contains a parfor loop or spmd block, it does not open an additional pool of workers on the
cluster. These code blocks execute on the single worker used for the batch job. If your batch script
requires opening an additional pool of workers, you can run it from the command line, as described in
“Run a Batch Job with a Parallel Pool” on page 1-9.
When you run a batch job from the browser, this also opens the Job Monitor. The Job Monitor is a tool
that lets you track your job in the scheduler queue. For more information about the Job Monitor and
its capabilities, see “Job Monitor” on page 5-24.
See Also
batch
Related Examples
• “Run Batch Job and Access Files from Workers”
1-11
1 Getting Started
Now MM is a distributed array, equivalent to M, and you can manipulate or access its elements in the
same way as any other array.
M2 = 2*MM; % M2 is also distributed, calculation performed on workers
x = M2(1,1) % x on the client is set to first element of M2
This code creates an individual 4-by-4 matrix, R, of random numbers on each worker in the pool.
Composites
Following an spmd statement, in the client context, the values from the block are accessible, even
though the data is actually stored on the workers. On the client, these variables are called Composite
objects. Each element of a composite is a symbol referencing the value (data) on a worker in the pool.
Note that because a variable might not be defined on every worker, a Composite might have
undefined elements.
Continuing with the example from above, on the client, the Composite R has one element for each
worker:
X = R{3}; % Set X to the value of R from worker 3.
The line above retrieves the data from worker 3 to assign the value of X. The following code sends
data to worker 3:
X = X + 2;
R{3} = X; % Send the value of X from the client to worker 3.
If the parallel pool remains open between spmd statements and the same workers are used, the data
on each worker persists from one spmd statement to another.
spmd
R = R + labindex % Use values of R from previous spmd.
end
1-12
Distribute Arrays and Run SPMD
A typical use for spmd is to run the same code on a number of workers, each of which accesses a
different set of data. For example:
spmd
INP = load(['somedatafile' num2str(labindex) '.mat']);
RES = somefun(INP)
end
Then the values of RES on the workers are accessible from the client as RES{1} from worker 1,
RES{2} from worker 2, etc.
There are two forms of indexing a Composite, comparable to indexing a cell array:
Although data persists on the workers from one spmd block to another as long as the parallel pool
remains open, data does not persist from one instance of a parallel pool to another. That is, if the pool
is deleted and a new one created, all data from the first pool is lost.
For more information about using distributed arrays, spmd, and Composites, see “Distributed
Arrays”.
1-13
1 Getting Started
• Accelerate your code using interactive parallel computing tools, such as parfor and parfeval
• Scale up your computation using interactive Big Data processing tools, such as distributed,
tall, datastore, and mapreduce
• Use gpuArray to speed up your calculation on the GPU of your computer
• Use batch to offload your calculation to computer clusters or cloud computing facilities
• Node: standalone computer, containing one or more CPUs / GPUs. Nodes are networked to form a
cluster or supercomputer
• Thread: smallest set of instructions that can be managed independently by a scheduler. On a GPU,
multiprocessor or multicore system, multiple threads can be executed simultaneously (multi-
threading)
• Batch: off-load execution of a functional script to run in the background
• Scalability: increase in parallel speedup with the addition of more resources
• MATLAB workers: MATLAB computational engines that run in the background without a graphical
desktop. You use functions in the Parallel Computing Toolbox to automatically divide tasks and
assign them to these workers to execute the computations in parallel. You can run local workers to
take advantage of all the cores in your multicore desktop computer. You can also scale up to run
your workers on a cluster of machines, using the MATLAB Parallel Server. The MATLAB session
you interact with is known as the MATLAB client. The client instructs the workers with parallel
language functions.
• Parallel pool: a parallel pool of MATLAB workers created using parpool or functions with
automatic parallel support. By default, parallel language functions automatically create a parallel
pool for you when necessary. To learn more, see “Run Code on Parallel Pools” on page 2-56.
For the default local profile, the default number of workers is one per physical CPU core using a
single computational thread. This is because even though each physical core can have several
virtual cores, the virtual cores share some resources, typically including a shared floating point
unit (FPU). Most MATLAB computations use this unit because they are double-precision floating
point. Restricting to one worker per physical core ensures that each worker has exclusive access
to a floating point unit, which generally optimizes performance of computational code. If your
code is not computationally intensive, for example, it is input/output (I/O) intensive, then consider
1-14
What Is Parallel Computing?
using up to two workers per physical core. Running too many workers on too few resources may
impact performance and stability of your machine.
• Speed up: Accelerate your code by running on multiple MATLAB workers or GPUs, for example,
using parfor, parfeval, or gpuArray.
• Scale up your data: Partition your big data across multiple MATLAB workers, using tall arrays and
distributed arrays. To learn more, see “Big Data Processing”.
• Asynchronous processing: Use parfeval to execute a computing task in the background without
waiting for it to complete.
• Scale up to clusters and clouds: If your computing task is too big or too slow for your local
computer, you can offload your calculation to a cluster onsite or in the cloud using MATLAB
Parallel Server. For more information, see “Clusters and Clouds”.
See Also
Related Examples
• “Choose a Parallel Computing Solution” on page 1-16
• “Identify and Select a GPU Device” on page 8-19
• “Decide When to Use parfor” on page 2-2
• “Run Single Programs on Multiple Data Sets” on page 3-2
• “Evaluate Functions in the Background Using parfeval” on page 1-23
• “Distributing Arrays to Parallel Workers” on page 3-10
• “Run Batch Parallel Jobs” on page 1-9
1-15
1 Getting Started
MATLAB Parallel
Server
1-16
Choose a Parallel Computing Solution
1-17
Exploring the Variety of Random
Documents with Different Content
Israelites bitten by the fiery serpents by the sight of the brazen
image, and he cured Naaman’s leprosy by bathing in the waters of
Jordan. Whatever then be the means which He prescribes, our
highest wisdom is to make use of them. But as he has not prescribed
the means recommended by the Talmud, but forbidden them in his
general prohibition of magic, we must say that the man who uses
them has bid adieu to all true wisdom. No wonder, then, if his own
inventions are stamped with folly. But what will our readers think of
the cause of the canine madness here assigned? “Rav says, It
proceeds from the witches who are making their sport with him.
Samuel says, It is an evil spirit that rests upon him.” Rav believed,
then, that God, whose mercies are over all his works, allows wicked
women to torment his creatures, and to inflict upon them a dreadful
malady to make sport for themselves. Is this wise, is it according to
Scripture? This is the doctrine of the oral law; and if Jesus of
Nazareth had not protested against it, and taught a true doctrine by
asserting the truth of Scripture, this would be the universal doctrine
and practice of the Jews. Whoever believes the Talmud, must
believe in this and all the other follies which it contains. Whoever
rejects these things, confesses that the Talmud contains what is
false and foolish, and thereby shakes or rather overthrows its
authority. Some person will perhaps say that similar superstitions
and follies have been found amongst Christians. We grant that this
has been the case wherever Christians have departed from the
written Word of God, but can anything similar be found in the New
Testament? That book is our standard of Christianity. As you say that
the oral law is of divine authority, we say that the New Testament is
of divine authority. We point out to you these follies, not in individual
Jews, but in your book of authority. If you would make out a parallel
case, you must do the same. But you cannot. The New Testament
has nothing of the kind; and it is for you to explain how this happens
that the New Testament, which you believe to be false, is entirely
free from every thing of the kind.
Further, we ask every right-minded Israelite, whether he is not
shocked at that profanation of the reverend and holy names of God
which is here not only countenanced but prescribed. What can a
devout Jew think either of the man or the book that tells us to write
the names,
יה יה יהוה צבאות ׃
“Jah, Jah, the Lord of Hosts,” by the side of such nonsense as Kanti,
Kanti, Klurus? Would he say that this is consistent with true religion?
And yet this profane use of the name of God for magical purposes, is
not rare in the Talmud. The following is another instance:—
האי גלא דמטבע לספינה מיתחזי כי צוציתא, אמר רבה אשתעו לי נחותי ימא
דנורא חיוורתא ברישא ומחינן ליה באלוותא דחקיק עליה אהיה אשר אהיה יה ה׳
צבאות אמן אמן סלה ונייח אמר רבה אשתעו לי נחותי ימא בין גלא לגלא תלת
מאה פרסי זמנא חדא הוה אזלינן באורחא ודלינן גלא עד דחזינן בי מרבעתא
ואי דלינן טפי מקלינן, דכוכבא זוטא והויא בי מבזר ארבעין גריוי בזרא דחרדלא
ורמי ליה גלא קלא לחברתה חברתי שבקת מידי בעלמא דלא שטפתיה, מהבלי
דניתי אנא ונאבדיה א׳׳ל הזי גבורתא דמריך מלא חוטא חלא ולא עברי שנאמר
האותי לא תיראו נאום ה׳ אם מפני לא תחילו אשר שמתי חול גבול לים חק עולם
ולא יעברנהו ׃
“Rabbah says, They that go down to the sea have told me, that when
a wave is going to overwhelm a ship, sparks of white light are seen
on its head. But if we strike it with a staff on which are graved the
words, ‘I am that I am, Jah, Lord of Hosts, Amen, Amen, Selah,’ it
subsides. They that go down to the sea have told me, that the
distance between one wave and another, is three hundred miles. It
happened once that we were making a voyage, and we raised a
wave until we saw the resting-place of the least of all the stars. It
was large enough to sow forty bushels of mustard seed, and if we
had raised it more we should have been burned by the vapour of the
star. One wave raised its voice and called to its companion, O,
companion, hast thou left anything in the world that thou hast not
overflowed? Come, and let us destroy it. It replied, Come and see
the power of thy Lord. I could not overpass the sand even a hair’s-
breadth, for it is written, ‘Fear ye not me? saith the Lord: will ye not
tremble at my presence, which have placed the sand for the bound
of the sea, by a perpetual decree that it cannot pass it?’ (Jer. v. 22.)”
(Bava Bathra, fol. 73, col. 1.) Here is the same profanation of the
peculiar and holy names of God: it is to be engraved on a staff either
to lay or to raise the waves. But besides the profanity, just consider
the folly of this whole story. In the first place, it ascribes to men, no
matter whether they are good or wicked, absolute power over the
waves of the sea. Anybody can engrave those names of God upon a
staff, anybody can use the staff to strike the sea, and thus a wicked
man, without either faith, fear, or love of God, may make and use an
instrument which almost invests him with omnipotence. Is it possible
that any son of Israel can be so credulous as to believe such
manifest absurdity? But this story reminds us again of the utter
disregard of truth which characterises the Talmud. Here we are told
that, by power of this magic staff, a wave was raised so high as to
enable those travellers to see the resting-place of the smallest of all
the stars, and that so distinctly, too, as to be able to make a good
guess at its measure. The slightest knowledge of modern astronomy
is sufficient to show not only the improbability, but the utter
impossibility of anything of the kind. The least of the stars visible to
the naked eye is at an almost immeasurable distance from the earth,
so as to make it perfectly ludicrous to talk of a wave being raised to
such a height. All the water on the face of the globe would be far
from sufficient for the formation of one such wave. But the Talmud
intimates that they had the power of raising it still higher, and were
prevented only by the fear of being scorched. But the Talmud is not
satisfied with these wonders, it goes on to describe a conversation
between two waves. The commentator, who evidently believed every
word of the story, suggest that this conversation was carried on by
the angels presiding over the waves.
ושמא מלאכים, ורמי ליה גלא נתן קולו כלומר צעק כדוגמא תהום אל תהום קורא
הממונים עליהם הם ׃
“The wave lifted up his voice, that is, it cried, and so we find, ‘Deep
calleth unto deep.’ And perhaps this means the angels who were set
over them.” The commentator, it appears, had no doubt of the truth
of the story, and how should he have, if he believed in the Divine
authority of the Talmud? But we ask our readers do they believe this
story—and if they do not, why not? Because it is too absurd, and too
far beyond the bounds of possibility. Can, then, a book that swarms
with similar accounts be from God? By what means did all these
things about magic, astrology, amulets, magical cures, and staves,
get into the Talmud? No doubt they were put in by the authors.
Either, then, the authors believed in all these things, or they did not.
If they did not believe in them, then they were evidently bad men,
who deliberately wrote falsehood. But if they did believe these
things, then, though not guilty of wilful falsehood, they were
credulous, superstitious persons, who had no clear idea of the
religion of Moses and the prophets; and in either case they are most
unsafe guides in religion. It is for the Jews of the present day to
consider whether they will still adhere to a system that involves the
belief of so many incredibilities and sanctions the profanation of the
names of God for the purposes of magic. Eighteen centuries are
surely long enough to have remained in such thick darkness. Those
who have been brought up in such a system ought now, at least, to
arise and ask what have they and their forefathers been about all
this while? And how it is that the New Testament, which they have
rejected, is entirely free from such deformities? Something has been
decidedly wrong, or the chosen people of God could not have
remained so long in captivity, unheeded and unhelped by the Holy
One of Israel. An exhibition of the doctrines of the oral law explains
the cause. Israel has departed from the religion of Moses, and
pertinaciously adhered to a system compounded of human
inventions, and idolatrous heathenism. They call Moses their master,
and say that the oral law is derived from him, but if we may from the
work, form a conjecture about the author, it is much more probably a
tradition from the magicians of Egypt or the witch of Endor. And if it
had been handed down as such—if the Israelites had presented the
Talmud to the world and their posterity as part of the heavy yoke of
Egypt, we should not have been astonished at the universality of its
reception. But that Israel should ever have been so far imposed
upon, as to believe that Moses or the prophets ever had anything to
do with the oral law appears almost inexplicable. However unwilling
one may be to apply to fellow-sinners any prophecy that contains a
denunciation of God’s wrath, one cannot help asking, was it of this
that the prophet said, “The Lord hath poured out upon you the spirit
of deep sleep, and hath closed your eyes; the prophets and your
rulers the seers hath he covered. And the vision of all is become
unto you as the words of a book that is sealed, which men deliver to
one that is learned, saying, read this, I pray thee; and he saith, I
cannot, for it is sealed: and the book is delivered to him that is not
learned, saying, Read this, I pray thee, and he saith, I am not
learned.” (Isaiah xxix. 10-12.) This question is, however, far more
important to Israel than to us, and to them we leave the answer.
Some will still persist in the assertion that this heathenish compound
is the highest wisdom. The great majority of the nation is devoted to
the Talmud, which is still the cistern whence the synagogues
endeavour to draw the waters of life. The multitude does it in
ignorance, they are, therefore, not so culpable. But there are many
that know better, what then is the reason that they do not strain
every nerve to deliver their brethren? These few do not suffer the
oral law to interfere either with their business or their convenience.
They profane the Sabbath, eat Gentile food, carry on their business
on feasts and festivals. If they do all this on principle, why not protest
against error? Is it because they are indifferent to the welfare of their
brethren? If indifference be the only fruit of this intellectual progress,
instead of rising above, they have sunk below superstition itself.
No. XXVI.
CHARMS CONTINUED.
How little the oral law has hitherto done to promote the peace and
happiness of Israel, we considered in our last number. It may,
however, be replied, that it has not had a fair trial, and that the failure
is to be attributed rather to the people than to the law. This possible
reply naturally leads us to think, what then would be the state of
Israel and of the world at large, if the oral law were universally and
exactly observed, and its disciples had supreme dominion in the
world? Suppose that all the kingdoms of the world were melted into
one vast and universal monarchy, and the sceptre swayed by a
devout and learned rabbi, and all the magisterial offices filled by able
and zealous Talmudists, would the world be happy? This is a fair
question, and well deserves consideration, for there can be no doubt
that true religion was intended by its Divine Author to promote the
happiness of his creatures:—
דוכיה דרכי נועם וכל נתיבוביה שלום ׃
“Her ways are ways of pleasantness, and all her paths are peace.”
(Prov. iii. 17.) And that not of a few, but of all without exception.
הלא אל אחד בראנו ׃, הלא אב אחד לכלנו
“Have we not all one father? Hath not one God created us?” (Mal. ii.
10.) That religion, therefore, cannot be of God, which would make
the greatest portion of his creatures miserable, and confer happiness
on a very limited number. The religion that came from heaven,
wherever it exists, must contain the elements of happiness for all
nations, and include all the families of man. It must exclude none but
the wilfully and obstinately wicked, who carry the torments of hell in
their own bosom, and would be necessarily unhappy even in heaven
itself. A religion, whose principles, if triumphant, would effect so
desirable a consummation, must be true. The question is, whether
modern Judaism, if it had full and free scope for the realization of all
its principles, would bear such blessed fruit? Our late inquiries about
amulets and magic led us to consider some of the laws about the
Sabbath-day, and as when true religion prevails, this ought to be the
happiest day of the week, the laws respecting it shall furnish
materials for our answer. That a rabbinical Sabbath would be the
happiest day in the week we much doubt, for, in the first place, to
keep the rabbinical Sabbath aright, it is necessary to be perfectly
acquainted with all the laws relating to it, which are very many and
very intricate, occupying even in Rambam’s compendium, including
the notes, above one hundred and seventy folio pages.[27] That any
conscientious man can be happy with such a load of law about his
neck appears impossible. He must be in continual fear and trembling
lest he should through forgetfulness or inadvertence be guilty of
transgression, and the continued watchfulness and anxiety would be
more intolerable than the hardest labour. But if Rabbinism wielded
the supreme power, he would have to dread the most severe and
immediate punishment:—
וכל העושה, שביתה בשביעי ממלאכה מצות עשה שנאמר וביום השביעי תשבות
, בו מלאכה ביטל מצות עשה ועבר על לא תעשה שנאמר לא תעשה כל מלאכה
ומהו חייב על עשיית מלאכה אם עשה ברצונו בזדון חייב כרת ואם היה שם עדים
והתראה נסקל ואם עשה בשגגה חייב קרבן הטאת קבועה ׃
“To rest on the seventh day from work is an affirmative precept, for it
is said, ‘On the seventh day thou shalt rest.’ Whosoever, therefore,
does any work, annuls an affirmative, and transgresses a negative
precept, for it is said, ‘Thou shalt do no manner of work.’ What is
meant by being guilty on account of doing work? If it be done
voluntarily and presumptuously, the meaning is, that he is liable to
excision, and if there were witnesses and a warning, he is to be
stoned. If he did it in error, he must bring a certain sin-offering.”
(Hilchoth Shabbath, c. i. 1.) This sounds something like the law of
Moses, but is in reality far more severe. The whole force depends
upon the meaning of the word “work,” and the rabbinical sense
would entirely destroy the peace of society. If, for instance, a poor
man could not afford to have his Sabbath lamp burn all day, and
should extinguish it to save the oil; or if a humane man should see
burning coals in some place likely to do injury to others, and should
extinguish them, they would both be guilty, and if some zealous
Talmudists happened to be present, and first remonstrated with them
on the unlawfulness of the act, they would both be tried, found guilty,
and stoned to death:—
כיצד, כל העושה מלאכה בשבת אע׳׳פ שאינו צריך לגופה של מלאכה חייב עליה
הרי שכבה את הנר מפני שהוא צריך לשמן או לפתילה כדי שלא יאבד או כדי שלא
ישרף או כדי שלא יבקע חרס של נר מפני שהכבוי מלאכה והרי נתכוון לכבות
ואע׳׳פ שאין צריך לגוף הכבוי ולא כבה אלא מפני השמן או מפני החרס או מפני
וכן המעביר את הקוץ ד׳ אמות ברה׳׳ר או המכבה את, הפתילה הרי זה חייב
הגחלת כדי שלא יזוקו בו רבים חייב ואע׳׳פ שאינו צריך לגוף הכבוי או לגוף
חהעברה אלא להרחיק ההיזק הרי זה חייב וכן כל כיוצא בזה ׃
“Whosoever does any work on the Sabbath, even though he does
not do it for the sake of the work itself, is nevertheless guilty. How
so? If, for instance, a man extinguishes a lamp, because he wants
the oil or the wick, and wishes that it should not waste, nor be
burned, or that the earthenware part of the lamp should not be
cracked; inasmuch as the extinguishing is work, and his intention
was to extinguish it: although the mere act of extinguishing it was not
the ultimate object, but on the contrary, the saving of the oil or the
wick, or the earthen lamp, he is, nevertheless, guilty. And in like
manner, whosoever, removes thorns a distance of four ells in a
public place, or whosoever extinguishes coals to prevent the public
from being injured, is guilty: although the ultimate object was not the
extinguishing nor the moving, but he simply intended to prevent the
injury, he is guilty, and so in all similar cases.” (Ibid.) If this were the
law of the land, and the executive were in the hands of Talmudistic
zealots, the peace of the world would be at an end. The poor man
could not be happy, when he saw his little property wasting; and the
humane man would either be made miserable at the thought of being
able to prevent much injury, and yet not doing it, or would have to
expose himself to the danger of a cruel and ignominious death. We
know enough of the general character of the Jewish nation to believe
that there are amongst them those who would brave the danger,
whose generous hearts would rise above personal considerations,
but how dreadful would be the consequences! A man of a tender
heart, the father of a family, would be induced, by the best of
feelings, to save his fellow-men from injury. He would return to his
family, and tell them how God had given him an opportunity of doing
good. The family worthy of such a father would rejoice to hear the
information, but the sequel of his story would turn their joy into
mourning. He would have to tell them that ignominious death would
be the consequence, and that because he dared to do an act of
charity, and to love his brother as himself, the morrow would see his
wife a widow and his children orphans. But suppose, that when he
performed the act, he had been attended by two of his sons, now
grown up, and zealots for the oral law—that they had warned him,
and then became his accusers, as they must, if firm believers in
Talmudic religion, he would have the additional pangs of seeing his
own flesh and blood as the foremost of his executioners. This one
law would clothe the world with mourning, and make the light of the
Sabbath sun the curse of mankind. Though men might be found at
first to brave the danger, the course of time and the inflexible severity
of the law would soon annihilate all generous feeling. Children would
be trained up with the idea that humanity is not a Sabbath virtue, and
the constant resistance of the tender feelings would harden the
heart, and mankind in time become totally insensible on week-days
as well as Sabbath-days; and thus the enforcement of this one law
would produce universal selfishness, and this would certainly not
promote the happiness of the world. But take another case of a man,
who leaves his home on the Friday morning to go a short distance
into the country, intending to return before the commencement of the
Sabbath; he meets with an accident, and breaks a limb; on the
Sabbath he is sufficiently restored to think of the anxiety of his family,
and writes a short note to inform them of his state, this act of
common love and kindness would cost him his life; nay, if he had
only begun the letter, and then overcome by fear or weakness, had
left it unfinished, a rabbinic tribunal would condemn him to be
stoned.
כל המתכוון לעשות מלאכה בשבת והתחיל בה ועשה כשיעור חייב אע׳׳פ שלא
כיצד הרי שנתכוון לכתוב אגרת או שטר, השלים כל המלאכה שנתכוון להשלימה
בשבת אין אומרים לא יתחייב זה עד שישלים חפצו ויכתות כל השטר או כל
האגרת אלא משיכתוב שתי אותיות חייב ׃
“Whosoever intends to do any work on the Sabbath, and begins it,
and does a certain measure, is guilty, although he does not finish all
that he intended. How so? Suppose he intended to write a letter, or a
contract on the Sabbath, it is not to be thought that he will not be
guilty until he finish his business, and write the whole contract or the
whole letter. On the contrary, as soon as he shall have written two
letters (of the alphabet) he is guilty.” (Ibid.) And consequently, if it can
be proved, must be stoned. Every one’s daily experience will tell
them of the many similar cases where a letter may be necessary for
the peace or well-being of an individual or a family, and where the
delay of a day would be a serious injury. If rabbinism held the reins
of power, the anxiety, the sorrow, the injury must all be endured; the
Sabbath-day must be made a burden and a curse, instead of a
blessing, or life itself must be exposed to danger. But this would not
be the only misery. These sanguinary laws would, as religious laws,
bind the consciences of the weak and superstitious. A man’s
domestics, or his children, or even his wife, would become spies
over all his Sabbath doings, and the denouncers of every
transgression; and thus domestic confidence, without which not even
the shadow of happiness can exist, would be destroyed, and a man’s
foes would be those of his own household. Much has lately been
thought and said about the sanguinary nature of the laws of England,
but the laws of Draco himself were merciful when compared with the
religious enactments of the rabbies. Draco only sentenced to death
men convicted of a crime. The oral law condemns to stoning the
man, woman, or child who will venture to write two letters of the
alphabet, or even who will extinguish fire to prevent a public injury.
Nay, in some cases, where it actually pronounces a man innocent, it
nevertheless commands him to be flogged.
נתכוון ללקוט תאנים שחורות וליקט לבנות או שנתכוון ללקוט תאנים ואחר כך
ענבים ונהפך הדבר וליקט הענבים בתחלה ואח׳׳כ תאנים פטור אע׳׳פ שליקט כל
מה שחשב הואיל ולא ליקט כסדר שחשב פטור שבלא כוונה עשה שלא אסרה
התורה אלא מלאכת מחשבת ׃
“If a man intended to gather black figs, but gathered white figs, or if
he intended to gather figs and afterwards grapes, but the matter has
been inverted, and he gathered the grapes first, and afterwards the
figs, he is not guilty. Although he have gathered all that he thought of
gathering, yet, because he did not gather them in the intended order,
he is not guilty, for he did what was unintentional, and the law forbids
only intentional work.” (Ibid.) We pass by the manifest absurdity of
this decision, which is, however, sufficient to prove that this law is not
of God, because it is more important to consider what is to be done
with a man not guilty. The law of England, or any other civilized
country, would say, of course, that he is to go free; but not so the oral
law, it commands that the man should be flogged.
הרי זה פטור מן הכרת ומן הסקילה, וכל מקום שנאמר שהעושה דבר זה פטור
ומן הקרבן אבל אסור לעשות אותו דבר בשבת ואיסורו מדברי סופרים והוא
הרחקה מן המלאכה והעושה אותו בזדון מכין אותו מכות מרדות ׃
“Wherever it is said, he that doeth anything is not guilty, the meaning
is, that he is not liable to excision, nor stoning, nor a sacrifice, but
that thing is unlawful to be done, and the prohibition is of the words
of the Scribes, and is intended as a removal from the possibility of
work: and he that does it presumptuously, is to be flogged with the
flogging of rebellion.” (Ibid.) Here, then, we have a whole class of
crimes which the oral law itself allows are no crimes according to the
law of Moses, but which it thinks fit to punish with that dreadful and
degrading infliction. Are the professors of this traditional religion
really acquainted with its ordinances? or can any man believe that a
religion which, if it had full scope and power, would become the
torment of the human race, can emanate from God?
If ever this religion attains supreme power, its adherents will be
reduced to a state of the most deplorable bondage, but what would
be its effect upon the other nations of the world? It would, in the first
place, deprive all other nations of a Sabbath; for we have already
quoted the law (No. 3, p. 22), which decides, “That a Gentile who
keeps a Sabbath, though it be on one of the week-days is guilty of
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com