![octave parallel octave parallel](https://64.media.tumblr.com/066cb91c129bed3640f70ef5dddf6f83/235b46e3c6e606f4-80/s1280x1920/18114bdb68623339a03e2b448835915a8d6b7435.jpg)
Over half of the 54 consecutives occur between the final chord of one phrase and the first chord of the next. parallels that disappear with the removal of NCTs)? To help give a clearer picture regarding questions of these types, the 54 instances of consecutives are categorized below. But exactly what kind of consecutives did Bach write and in what specific contexts? Did he write consecutive octaves or fifths only? Did he only write parallels that involve non–chord tones (i.e. In fact, no fewer than 54 instances of consecutives perfect fifths and octaves can be found in the chorales. (In other words, parallel fifths/octaves cannot be corrected through octave transference.) Because of this, the forbidden fifths/octaves under discussion here will be referred to as " consecutive fifths/octaves" or even more simply "consecutives."ĭo consecutives fifths and octaves occur in Bach’s chorales? While this rule refers to parallel fifths/octaves - that is, consecutive harmonic perfect fifths and octaves in parallel contrapuntal motion - consecutive fifths or octaves in contrary motion are categorically the same and are also to be avoided. While no thorough account of the rationale behind this rule will be rehearsed here, suffice it to say that parallel fifths and octaves violate the principles of counterpoint by interfering with the independence of voices required.
Octave parallel code#
By using these techniques, we've seen users speed up their code over 32x while still using a single machine.Consecutive Fifths & Octaves in the ChoralesĬonsecutive Fifths & Octaves in the Bach ChoralesĪvoiding parallel fifths and octaves is one of the foundational "rules" of counterpoint. Modern statistical languages make it incredibly easy to parallelize your code across cores, and Domino makes it trivial to access very powerful machines, with many cores. Note that you can use the parcellfun function if your inputs are not numbers (e.g., if they are file names or product identifiers).
Octave parallel install#
% you'll need to run this once, to install the package: Here's how you can use it: if exist('OCTAVE_VERSION') ~= 0 Unfortunately, Octave doesn't have a nice parfor equivalent - but it does have its own Parallel package. Note that if your inputs are not integers (e.g., they are file names or item identifiers), you can use the parcellfun function, which operates on cell inputs, rather than array inputs. % assumes that processInput is defined in a separate function file Matlab's Parallel Computing Toolbox makes it trivial to use parallel for loops using the parfor construct. You can find some more info on the difference between mclapply and parLapply on this StackOverflow postĪs an alternative, you can also use the foreach package, which lets you use a familiar for loop syntax, automatically parallelizing your code under the hood: library(foreach) Results = parLapply(cl, inputs, processInput)
![octave parallel octave parallel](https://1.bp.blogspot.com/-kHh5iB6qI9Q/XolsDM7ZMwI/AAAAAAAADbs/bRDiUlG43zETBDZ69O3loHW0EaiDgXfkACLcBGAsYHQ/s1600/LP_TC_09.png)
# the above won't work on Windows, but this will: Results = mclapply(inputs, processInput, mc.cores = numCores) Since 2.14, R has included the Parallel library, which makes this sort of task very easy. Results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs # what are your inputs, and what operation do you want to Python has a great package, that makes parallelism incredibly easy. You would use your specific data and logic, of course. To make our examples below concrete, we use a list of numbers, and a function that squares the numbers.
![octave parallel octave parallel](https://64.media.tumblr.com/tumblr_lwo1htmDwe1r83bzqo1_400.png)
Octave parallel how to#
Instead of processing your items in a normal a loop, we'll show you how to process all your items in parallel, spreading the work across multiple cores. Normally you would loop over your items, processing each one: for i in inputs (After this step, you can then combine your results however you want, e.g., aggregating them, saving them to a file - it doesn't matter for our purposes.)