Multi-threading

How to check the number of threads Threads.nthreads() Output: 8 For me, I have eight threads at my disposal for code execution. How to check thread id Threads.threadid() Output: 1 Since we are on the master thread, Threads.threadid() will return 1. @threads Macro Below we create a with 10 elements in it, then use multi-threads to put thread id used to process the given for loop. To use multi-thread, we use Threads....

May 3, 2023 · 1 min · 114 words · Me

reshape and permutedims

The elements in the reshaped matrix will always be orderded column-wise. For example, consider the following code: using LinearAlgra C = [1,2,3,4,5,6] reshape(C, (2,3)) Output: 2×3 Matrix{Int64}: 1 3 5 2 4 6 Notice that number 2 is placed in the first column of the second row, instead of the second column of the first row. Suppose that we want to create a 2-by-3 matrix where the first row is initially filled and the second row is filled afterwards....

May 2, 2023 · 1 min · 181 words · Me