Data generation method, apparatus, and computer-readable storage medium for brain simulation
By performing random number multiplication and comparison operations in parallel to generate Poisson input values, the problem of low computational efficiency in existing technologies is solved, and the efficiency of Poisson value generation is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LYNXI TECH CO LTD
- Filing Date
- 2022-11-23
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies are computationally inefficient and consume a lot of computational resources when generating random sequences with a Poisson distribution, making them difficult to adapt to parallel computing.
By generating a predetermined number of random numbers, performing a predetermined number of random number multiplication operations in parallel, multiple operation results are obtained, and a Poisson input value is generated based on the comparison results of the operation results with a predetermined reference value.
It improves the efficiency of generating Poisson values for each neuron, reduces computation time and space consumption, and is suitable for parallel computing environments.
Smart Images

Figure CN115759180B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a data generation method, apparatus and computer-readable storage medium for brain simulation. Background Technology
[0002] A Poisson generator is a widely used device in brain simulation systems. It generates random sequences that conform to a Poisson distribution, containing multiple random numbers, each of which can serve as the Poisson input value for a neuron in the simulation system. Typically, generating these random sequences requires extensive computation, consuming significant computational resources and resulting in low computational efficiency. Summary of the Invention
[0003] This disclosure provides a data generation method, apparatus, and computer-readable storage medium for brain simulation, which can improve the efficiency of generating Poisson values for each neuron.
[0004] In a first aspect, this disclosure provides a data generation method for brain simulation, the method comprising: generating a predetermined number of random numbers in response to a received calculation instruction; performing a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers to obtain multiple calculation results; and generating Poisson input values corresponding to multiple neurons in the brain simulation system based on a comparison result between the multiple calculation results and a predetermined reference value.
[0005] Secondly, this disclosure provides a data generation device applied to a brain simulation system. The device includes: a random number generator, an accumulator, a comparator, and an adder. The random number generator is used to generate a predetermined number of random numbers in response to a received calculation instruction. The accumulator is used to perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers to obtain multiple calculation results. The comparator is used to determine the comparison results between the multiple calculation results and a predetermined reference value. The adder is used to generate Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison results.
[0006] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processing core, implements the above-described data generation method for brain simulation.
[0007] The embodiments provided in this disclosure can generate a predetermined number of random numbers in response to a received calculation instruction, and perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers to obtain multiple calculation results. Then, based on the comparison results of the multiple calculation results with predetermined reference values, Poisson input values corresponding to multiple neurons in the brain simulation system are generated. Since this method can generate a set of Poisson values at once through parallel and batch calculations, it effectively improves the generation efficiency of Poisson values corresponding to each neuron.
[0008] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:
[0010] Figure 1 A flowchart illustrating a data generation method for brain simulation provided in this disclosure embodiment;
[0011] Figure 2 A flowchart of a data generation method provided in the embodiments of this disclosure;
[0012] Figure 3 A block diagram of a data generation device provided in an embodiment of this disclosure;
[0013] Figure 4 This is a schematic diagram of the architecture of a data generation device provided in an embodiment of the present disclosure;
[0014] Figure 5 This is a schematic diagram of the architecture of another data generation device provided in an embodiment of this disclosure. Detailed Implementation
[0015] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0016] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0017] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0018] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0019] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0020] In this embodiment of the disclosure, the Poisson distribution is suitable for describing the number of times a random event occurs per unit of time. In practical applications, random numbers with a Poisson distribution exist in many scenarios. For example, the number of calls made at a telephone exchange within a certain period of time, the number of passengers arriving at a bus station, the number of printing errors on a page of a book, the number of lost mailed in a certain area in a day, the number of emergency room patients in a hospital in a day, and the number of a certain type of bacteria falling on a microscope all follow a Poisson distribution.
[0021] Brain simulation involves using computers to model the brain's microscopic units (neurons, synapses, ion channels, etc.) to construct complex neural network systems that simulate the functions and processes of neural signals from generation to transmission to motor behavior. Brain simulation primarily mimics physical characteristics, meaning that when neurons in a brain simulation system process input data, they pay less attention to the specific numerical values of the input data and more to the trends in those trends.
[0022] In some scenarios, to ensure that the generated input data conforms to a Poisson distribution, a Poisson generator based on a Poisson data generation algorithm can be used to generate a random sequence with a Poisson distribution. As an example, the processing steps of a Poisson data generation algorithm may include the following: Step 1: Given a parameter λ, where λ is greater than 0, the probability density function e^(-λ / λ) of the exponential distribution is used... -λ First, generate a series of random numbers that are uniformly distributed within the open interval (0, 1). Second, calculate the product of these random numbers. When the product is less than or equal to a threshold value, stop the product operation and record the number of random numbers involved in the product calculation at this point. Third, when the product operation terminates, the number of random numbers involved in the product operation minus one follows a Poisson distribution with parameter λ. The number of random numbers involved in the product operation minus one at the time of termination is taken as a Poisson value.
[0023] As can be seen from the Poisson data generation algorithm, the number of random numbers involved in the product operation and the number of product operations are often inconsistent when generating each Poisson value. Generating T Poisson values typically requires T product operations with a different number of iterations, where T is an integer greater than or equal to 1. Since generating T Poisson output values requires T iterative calculations with a different number of iterations, the process of generating multiple Poisson values is a serial execution process. The entire computation process incurs significant scheduling logic overhead, making it unsuitable for parallel computing and resulting in low efficiency in generating Poisson values.
[0024] The data generation method for brain simulation according to embodiments of this disclosure can be executed by electronic devices such as data generation devices or data generation servers. The terminal device can be an in-vehicle device, user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The above method can be implemented by a processor calling computer-readable program instructions stored in memory. The server can include a standalone physical server, a server cluster consisting of multiple servers, or a cloud server capable of cloud computing.
[0025] Figure 1 A flowchart illustrating a data generation method for brain simulation provided in this disclosure. (Refer to...) Figure 1 The data generation method for brain simulation may include the following steps.
[0026] S110, in response to the received calculation instruction, generates a predetermined number of random numbers.
[0027] In this step, random numbers can be generated using a random number generator, which can be a hardware random number generator or a software (pseudo) random number generator. Regardless of whether it is a hardware or software random number generator, the random values generated each time are unpredictable, in order to meet the characteristics of the unpredictable or irregular phenomena mentioned above.
[0028] S120: Based on a predetermined number of random numbers, perform a predetermined total number of random number multiplication operations in parallel to obtain multiple operation results.
[0029] In this step, the results of multiple operations are the multiplication results of multiple random numbers. Random number multiplication can be understood as a cumulative multiplication of random numbers. Therefore, the predetermined total number of operations is the total number of cumulative multiplication operations. The setting of the total number of cumulative multiplication operations must ensure that the result of each random number multiplication operation is less than or equal to a predetermined reference value with a high probability. At this point, subtracting one from the number of random numbers involved in the product operation yields the Poisson value. It can be seen that the Poisson value corresponds to a random number multiplication result higher than the predetermined reference value (the Poisson value is the cumulative multiplication count higher than the predetermined reference value). Let the maximum value of the Poisson value be denoted as Pmax. Then, Pmax is less than or equal to the total number of cumulative multiplication operations. Since the maximum value of the Poisson value is correlated with the normalization rate, an empirical value can be set based on the normalization rate as the total number of cumulative multiplication operations.
[0030] In some embodiments, the predetermined total number of operations is not absolute. If the total number of cumulative multiplication operations is set too small, the maximum value of the calculated Poisson value may be less than the theoretical Pmax. This is equivalent to clamping the Poisson value, which means that when the Poisson value is greater than or equal to a threshold, the Poisson value will be clamped (limited) to that threshold. If the total number of cumulative multiplication operations is too large, the number of multiplication operations increases, and the computational load will also be too high. Therefore, considering the hardware cost, the total number of cumulative multiplication operations needs to be large enough but should not be set too large. In practical applications, the total number of cumulative multiplication operations can be set based on empirical or experimental values. For example, when normrate = 1.0, the total number of cumulative multiplication operations can be set to 32, 33, etc.
[0031] In practical applications, the total number of cumulative multiplication operations can be set in other ways, as long as the total number of cumulative multiplication operations is set in such a way that the result of multiplying each random number is less than or equal to the predetermined reference value.
[0032] S130: Based on the comparison results of multiple calculation results with predetermined reference values, generate Poisson input values corresponding to multiple neurons in the brain simulation system.
[0033] For example, if the predetermined reference value is denoted as M_lm_thr, then the value of M_lm_thr can be expressed as: M_lm_thr = exp(-normrate), where exp represents an exponential function with base e, and exp(-normrate) represents... M_lm_thr is a value between (0, 1) raised to the power of normrate.
[0034] In some embodiments, multiple calculation results can be compared with a predetermined reference value. If a calculation result is greater than the predetermined reference value, the number of random numbers involved in the random number multiplication operation corresponding to that calculation result can be used as a Poisson input value for a neuron.
[0035] According to the data generation method for brain simulation according to the embodiments of this disclosure, after generating a predetermined number of random numbers, a predetermined total number of random number multiplication operations are performed to obtain multiple operation results. Then, the multiple operation results are compared with a predetermined reference value. Based on the comparison results, Poisson input values corresponding to multiple neurons in the brain simulation system can be generated. In this data generation method, the number of random number multiplication operations required to output each Poisson value is fixed. This allows multiple random number multiplication operations to be performed in parallel to obtain multiple operation results. Furthermore, the comparison between each operation result and the predetermined reference value can be performed in parallel. Based on the comparison results, Poisson input values corresponding to multiple neurons in the brain simulation system are generated. This method is beneficial in removing the limitation in related technologies that the termination of random number multiplication operations requires meeting specific stopping conditions. The scheduling logic involved in the entire operation process—random number generation, parallel random number multiplication operations, and numerical comparison—consumes less time and space. That is, the scheduling logic overhead of the entire operation process is small. By generating a set of Poisson values at once through parallel and batch operations, the generation efficiency of Poisson values corresponding to each neuron is improved.
[0036] In some embodiments, the step of generating a predetermined number of random numbers in step S110 may include: S01, generating a random number array, wherein the number of rows in the random number array is N, and each row contains M random numbers, where N is an integer greater than 1 and M is an integer greater than 2.
[0037] For example, the generated random number array can be represented by the following expression (1):
[0038]
[0039] In the above expression (1), the size of the random number array X is M*N, that is, X is an M-row N-column random number array. Each column vector is denoted as X0. i ;X iLet X be a one-dimensional vector of length N. For ease of description, the random number array X can be represented as X = [X0; X1; ...; X...]. M-1 The column numbers (0 to N-1) are omitted, and the semicolon indicates vertical concatenation. For example, in a random number array X:
[0040] When i = 0, X i That is, X0, where X0 represents the column vector [X 0,0 X 0,1 ..., X 0,N-1 ] - ;
[0041] When i=1, X i That is, X1, where X1 represents the column vector [X 1,0 X 1,1 ..., X 1,N-1 ] T ;
[0042] ...;
[0043] When i = M-1, X i That is, X M-1 X M-1 Represents column vector [X] M-1,0 X M-1,1 , ..., X M-1,N-1 ] T ;
[0044] Where T represents the transpose of a vector.
[0045] In this embodiment, step S120 may specifically include: S02, for N rows of random numbers, calculate the cumulative multiplication of M random numbers in each row in parallel; wherein, the cumulative multiplication operation of each row is performed M-1 times to obtain M-1 cumulative multiplication results for each row.
[0046] For example, when calculating the cumulative product of M random numbers in each row in parallel, the result of each cumulative product is denoted as Y. k Where k takes values from 0 to M-2, and Y0 to Y... M-2 This represents the result of the first cumulative multiplication operation to the (M-1)th cumulative multiplication operation. In each step of the cumulative multiplication process, starting from k=1, the result Y of each cumulative multiplication operation... k The calculation depends on the result Y of the previous cumulative multiplication operation. k-1 .
[0047] As a concrete example, the cumulative multiplication operation of each row in the N rows of random numbers is performed M-1 times, resulting in M-1 cumulative multiplication results for each row. For ease of understanding, the following shows the cumulative multiplication results of each row of random numbers from the 1st to the M-1th cumulative multiplication operation, and these M-1 cumulative multiplication results can be represented as an array of cumulative multiplication results.
[0048] The first cumulative multiplication operation can be expressed as: Y0=X0*X1, which corresponds to the cumulative multiplication result obtained by performing one cumulative multiplication operation on each of the N rows of random numbers in the above expression (1);
[0049] The second cumulative multiplication operation can be expressed as: Y1=Y0*X2, which corresponds to the cumulative multiplication result obtained by performing two cumulative multiplication operations on each of the N rows of random numbers in the above expression (1);
[0050] The third cumulative multiplication operation can be expressed as: Y2=Y1*X3, which corresponds to the cumulative multiplication result obtained by performing three cumulative multiplication operations on each of the N rows of random numbers in the above expression (1); ...;
[0051] The (M-1)th cumulative multiplication operation can be represented as: Y M-2 =Y M-3 *X M-1 The result of the cumulative multiplication operation is obtained by performing M-1 cumulative multiplication operations on each of the N rows of random numbers in the above expression (1).
[0052] The above calculation process shows that for a random number array X = [X0; X1; ...; X...], ... M-1 There are N rows and M columns of random numbers. Perform M-1 cumulative multiplication operations on the random numbers in each row to obtain M-1 cumulative multiplication results for each row.
[0053] For example, the result of M-1 cumulative multiplication operations in each of the N rows can be represented by the following expression (2):
[0054]
[0055] In the above expression (2), each column in the cumulative multiplication result Y is the result of one cumulative multiplication operation; for each element Y(i, j) in the cumulative multiplication result Y, the value of i is from 0 to M-2, and the value of j is from 0 to N-1. Y(i, j) can be simplified to Y i When i takes values from 0 to M-2, it represents the result of the cumulative multiplication operation from the 1st to the M-1th.
[0056] In some embodiments, S130 may specifically include:
[0057] S11, compare the M-1 cumulative multiplication results of each row in the N rows with a predetermined reference value in parallel, and perform binarization processing on the M-1 cumulative multiplication results of each row according to the comparison results to obtain M-1 binary sample data of each row; wherein, the values of the binary sample data include 1 values and non-1 values.
[0058] In some embodiments, step S11, which involves binarizing the M-1 cumulative multiplication results of each row based on the comparison results to obtain M-1 binary sample data for each row, may specifically include: setting the cumulative multiplication result greater than a predetermined reference value to 1 in the comparison results; and setting the cumulative multiplication result less than or equal to the predetermined reference value to 0.
[0059] Referring to the above expression (2), for each of the M-1 cumulative multiplication results in the N rows, if any element is represented as Y(i, j), then the value of i is from 0 to M-2, and the value of j is from 0 to N-1; Y(i, j) can be simplified to Y i .
[0060] Binarize Y(i,j) and denote the result as Z(i,j). The binarization process can be expressed as the following expression (2):
[0061] Z(i,j)=1if(Y(i,j)>M_lm_thr)else 0(3)
[0062] Combining the above expression (2), we can see that the meaning of expression (3) is: for M-1 cumulative multiplication results, if any element Y(i,j) is greater than the predetermined reference value M_lm_thr, then the binary sample data Z(i,j) corresponding to Y(i,j) is equal to 1; otherwise, the binary sample data Z(i,j) corresponding to Y(i,j) is equal to 0.
[0063] In this embodiment, binarizing the M-1 cumulative multiplication results of each of the N rows helps reduce data storage space. Furthermore, when counting the number of cumulative multiplication results greater than a predetermined reference value among the M-1 cumulative multiplication results of each of the N rows, it is sufficient to directly count the number of binary sample data equal to 1 among the M-1 cumulative multiplication results of each row, which helps improve data processing efficiency.
[0064] S12, calculate the sum of the binary sample data with a value of 1 in each row, and obtain the sum calculation result of each row; S13, take the sum calculation result of each row as the Poisson value of the corresponding row, and take the Poisson value corresponding to each row in N rows as the Poisson input value of multiple neurons in the brain simulation system.
[0065] For example, continuing to refer to the cumulative multiplication result of N rows and M-1 columns of the above expression (2), for each j∈[0,N-1], through the expression To count the number of 1s in all i∈[0,M-2], we obtain the Poisson value for each of the N rows.
[0066] Through the above steps S12 and S13, by calculating the sum of the binary sample data with a value of 1 in each row, the number of binary sample data with a value of 1 in each row is obtained. This number is the number of times the cumulative multiplication result of each row is greater than a predetermined reference value. Thus, the Poisson value corresponding to each row in N rows is obtained. By combining and calculating, a set of Poisson values is obtained, which improves the generation efficiency of the Poisson value corresponding to each neuron.
[0067] In this embodiment of the disclosure, the neuron is the neuron used by the brain simulation application, and the brain simulation application runs on the brain simulation system; the predetermined reference value is calculated in advance based on the pulse firing rate of the neuron and the simulation time granularity. The data generation method further includes: S21, determining the normalized rate of the brain simulation application based on the product of the pulse firing rate of the neuron and the simulation time granularity obtained in advance; S22, performing an exponential operation based on the negative of the normalized rate to obtain the exponential operation result; wherein, the value of the exponential operation result is greater than zero and less than 1; S23, using the exponential operation result as the predetermined reference value.
[0068] In step S21, for example, assuming S is the number of Poisson outputs (number of neurons), and normrate is the normalized rate, normrate can be directly set by the user or calculated using the normalization formula. In brain simulation applications, the normalized rate can be calculated as normrate = rate * timescale, where rate and timescale represent the firing rate and simulation time granularity, respectively.
[0069] In step S22, for example, the predetermined reference value is denoted as M_lm_thr, and the value of M_lm_thr can be expressed as: M_lm_thr = exp(-normrate), where -normrate is the negative of normrate, and exp(-normrate) represents an exponential function with base e.
[0070] Figure 2 A flowchart illustrating a data generation method according to an exemplary embodiment of this disclosure is provided. Figure 2 As shown, the data generation method includes the following steps.
[0071] S201, the uniform random number generator receives the calculation instruction.
[0072] S202, the random number generator generates M uniform random number samples.
[0073] In this step, the M uniformly random number samples are represented as: X0; X1; ...; X M-1 Each uniformly random number sample is an N-row, 1-column random number, for a total of N*M random numbers.
[0074] S203: For N rows of random numbers, calculate the cumulative product of M random numbers in each row in parallel to obtain M-1 weighted random number samples.
[0075] In each step, the cumulative multiplication operation is performed M-1 times, resulting in M-1 cumulative multiplication results for each row. Each cumulative multiplication result can be considered as a different weighted value of a uniformly random number sample X0. For example, Figure 2 Y0 to Y M-2 This represents the result of the first cumulative multiplication operation (using the N random numbers in X1 as weights for the corresponding random numbers in X0, multiplying them to form the first weighted random number sample) to the result of the (M-1)th ... random numbers in X1 to X0) to form the first weighted random number sample. M-2 The random numbers at the same position in X0 are multiplied together as the weights of the random numbers at the corresponding positions in X0, and this multiplication is used as the (M-1)th weighted random number sample.
[0076] S204 performs binarization on M-1 weighted random number samples to obtain binary samples.
[0077] In this step, the value of each random number in the M-1 weighted random number samples is compared with a predetermined reference value. If it is greater than the predetermined reference value, the corresponding random number is set to 1; otherwise, it is set to 0. For example... Figure 2 As shown, M-1 weighted random number samples Y0 to Y... M-2 The binary samples obtained by binarization are denoted as Z1 to Z2. M .
[0078] S205, calculate the sum of the binary sample data with a value of 1 in each binary sample, and use it as a set of Poisson values.
[0079] In the steps, if Z1 to Z M Each binary sample in the dataset contains N rows and 1 column of sample data. By adding the sample data in each binary sample vertically, we can obtain the sum of the binary sample data with a value of 1 in each binary sample.
[0080] Through the above steps S201-S205, steps S203-S205 can all perform parallel M-1 cumulative multiplication calculations, thereby generating a set (N) Poisson values (corresponding to the Poisson inputs of N neurons) at once. Compared with related technologies, when the number of cumulative multiplications is uncertain when calculating Poisson values, the generation process of each Poisson value needs to be executed serially, and dynamic and variable loop judgment conditions need to be set for the cumulative multiplication calculations involved in the generation of each Poisson value, resulting in a large amount of computing resources consumed and low computing efficiency, the data generation method of this disclosure embodiment can batch calculate a set of Poisson values, which is suitable for batch calculation of Poisson values, saves computing resources and improves the generation efficiency of Poisson values.
[0081] The parallel processing flow for data generation in the embodiments of this disclosure is described below with reference to specific examples.
[0082] In some embodiments, after generating the random number array in step S01, the data generation method further includes: storing the random number array into a first data buffer;
[0083] Before performing the cumulative multiplication of M random numbers in each row in parallel for N rows of random numbers in step S02, the data generation method further includes: obtaining a random number array from the first data buffer; and after obtaining the M-1 cumulative multiplication results of each row, the data generation method further includes: storing the M-1 cumulative multiplication results of each row into the first data buffer.
[0084] Before performing binarization processing on the M-1 cumulative multiplication results of each of the N rows in parallel with a predetermined reference value in step S11, the data generation method further includes: obtaining the M-1 cumulative multiplication results of each row from a first data buffer; and after obtaining the M-1 binary sample data of each row in step S11, the data generation method further includes: storing the M-1 binary sample data of each row into the first data buffer.
[0085] Before calculating the sum of the binary sample data with a value of 1 in each row in step S12, the data generation method further includes: obtaining M-1 binary sample data of each row from the first data buffer; and after obtaining the sum calculation result of each row in step S12, the data generation method further includes: storing the sum calculation result of each row into the first data buffer.
[0086] In this embodiment, a first data buffer is pre-set. The random number array generated in step S01 is stored in the first data buffer. Before the cumulative multiplication operation in step S02, the random number array is retrieved from the first data buffer. After the cumulative multiplication operation, the result of the cumulative multiplication operation is stored back into the first data buffer. Before the comparison operation in step S11, the result of the cumulative multiplication operation is retrieved from the first data buffer. After binarization, the result of the binary sample data is stored back into the first data buffer. And before the sum calculation in step S12, the binary sample data is retrieved from the first data buffer. After the sum calculation, the result of the sum calculation is stored back into the first data buffer. It can be seen that the above-mentioned cumulative multiplication operation, comparison operation, and sum calculation are all calculations with in-situ operation capability. That is, the output data of each step can be directly stored back to the original storage location of the corresponding input data. Therefore, the in-situ operation storage method can be adopted. In this method, each calculation module is performed sequentially, and the data buffer only needs to store N*M data, which is beneficial to improve resource utilization and reduce storage space.
[0087] In some embodiments, after generating the random number array in step S01, the data generation method further includes: storing the generated random number array into a second data buffer;
[0088] Before performing the cumulative multiplication of M random numbers in each row in parallel for N rows of random numbers in step S02, the data generation method further includes: obtaining a random number array from the second data buffer; and after obtaining the M-1 cumulative multiplication results of each row, the data generation method further includes: storing the M-1 cumulative multiplication results of each row into the third data buffer.
[0089] Before performing binarization processing on the M-1 cumulative multiplication results of each of the N rows in parallel with a predetermined reference value in step S11, the data generation method further includes: obtaining the M-1 cumulative multiplication results of each row from a third data buffer; and after obtaining the M-1 binary sample data of each row in step S11, the data generation method further includes: storing the M-1 binary sample data of each row into a fourth data buffer.
[0090] Before calculating the sum of the binary sample data with a value of 1 in each row in step S12, the data generation method further includes: obtaining M-1 binary sample data of each row from the fourth data buffer; and after obtaining the sum calculation result of each row in step S12, the data generation method further includes: storing the sum calculation result of each row into the fifth data buffer.
[0091] In this embodiment, four data buffers (second to fifth) are pre-set. The random number array generated in step S01 is stored in the second data buffer. Before the cumulative multiplication operation in step S02, the random number array is retrieved from the second data buffer. After the cumulative multiplication operation, the result is stored in the third data buffer. Before the comparison operation in step S11, the result is retrieved from the third data buffer. After binarization, the binary sample data is stored in the fourth data buffer. Before the sum calculation in step S12, the binary sample data is retrieved from the fourth data buffer. After the sum calculation, the result is stored in the fifth data buffer. It can be seen that the generation of random numbers, the cumulative multiplication operation, the comparison operation, and the sum calculation can form a data generation pipeline. When high-throughput data generation is required, the pipelined processing flow can improve the generation efficiency of Poisson input values corresponding to multiple neurons in the brain simulation system.
[0092] According to the data generation method of this disclosure, after generating a predetermined number of random numbers, a predetermined total number of random number multiplication operations are performed to obtain multiple operation results. These multiple operation results are then compared with a predetermined reference value. Based on the comparison results, Poisson input values corresponding to multiple neurons in the brain simulation system can be generated. In this data generation method, the number of random number multiplication operations required to output each Poisson value is fixed. This allows for parallel execution of multiple random number multiplication operations to obtain multiple operation results. Furthermore, it allows for parallel comparison of each operation result with a predetermined reference value. Based on the comparison results, Poisson input values corresponding to multiple neurons in the brain simulation system are generated. This method helps to eliminate the limitation in related technologies where the termination of random number multiplication operations requires meeting specific stopping conditions. The scheduling logic involved in the entire operation process—random number generation, parallel random number multiplication operations, and numerical comparison—consumes less time and space, resulting in lower scheduling logic overhead. By generating a set of Poisson values at once through parallel and batch operations, the generation efficiency of Poisson values corresponding to each neuron is improved.
[0093] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0094] Figure 3 This is a block diagram of a data generation device provided in an embodiment of this disclosure. (Refer to...) Figure 3This disclosure provides a data generation device 300, which may include the following modules.
[0095] Random number generator 310 is used to generate a predetermined number of random numbers in response to a received calculation instruction;
[0096] The accumulator 320 is used to perform random number multiplication operations in parallel a predetermined number of times based on a predetermined number of random numbers, and obtain multiple operation results;
[0097] Comparator 330 is used to determine the comparison result of multiple calculation results with a predetermined reference value;
[0098] Adder 340 is used to generate Poisson input values for multiple neurons in the brain simulation system based on the comparison results.
[0099] According to the data generation device of this disclosure, after a random number generator generates a predetermined number of random numbers, a multiplier performs a predetermined number of random number multiplication operations to obtain multiple operation results. A comparator compares the multiple operation results with a predetermined reference value, and then an adder generates Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison results. In this data generation device, the Poisson input values corresponding to multiple neurons in the brain simulation system are generated through the cooperation of various modules. This method is beneficial to removing the restriction in related technologies that the termination of the multiplication operation of random numbers needs to meet specific stopping conditions. The time and space consumption of the operations involved in the scheduling logic of the entire operation process—random number generation, parallel random number multiplication operation, and numerical comparison—are relatively small. That is, the scheduling logic overhead of the entire operation process is small. By generating a set of Poisson values at once through parallel and batch operations, the generation efficiency of Poisson values corresponding to each neuron is improved.
[0100] In some embodiments, the random number generator is configured to generate a random number array in response to a received calculation instruction. The random number array has N rows, and each row contains M random numbers, where N is an integer greater than 1 and M is an integer greater than 2. The accumulator is configured to perform parallel calculations of the cumulative product of the M random numbers in each of the N rows of random numbers, wherein the number of cumulative product operations for each row is M-1, resulting in M-1 cumulative product results for each row. The comparator is configured to compare the M-1 cumulative product results of each of the N rows with... Based on a predetermined reference value, the M-1 cumulative multiplication results of each row are binarized according to the comparison results to obtain M-1 binary sample data for each row; wherein, the values of the binary sample data include 1 and non-1 values; the summer is used to calculate the sum of the binary sample data with a value of 1 in each row to obtain the sum calculation result of each row, and the sum calculation result of each row is used as the Poisson value of the corresponding row, and the Poisson value corresponding to each of the N rows is used as the Poisson input value of multiple neurons in the brain simulation system.
[0101] In this embodiment, the multiplication operation of the accumulator, the comparison operation of the comparator, and the summation operation of the adder are all parallel processing procedures, which helps to improve the generation efficiency of Poisson input values corresponding to multiple neurons in the brain simulation system generated by the data generation device.
[0102] The following is combined Figure 4 and Figure 5 This section describes a schematic diagram of the architecture of the data generation device in an embodiment of this disclosure. Figure 4 This is a schematic diagram of the architecture of a data generation device provided in an embodiment of the present disclosure; Figure 5 This is a schematic diagram of the architecture of another data generation device provided in an embodiment of this disclosure. Figure 4 , Figure 5 and Figure 3 The same or equivalent structures use the same labels.
[0103] In some embodiments, Figure 4 and Figure 3 The difference is that, Figure 4 The data generation device 300 also includes a first data buffer 350, which, exemplarily, is an in-situ computation data buffer. Figure 4As shown, the data generation device further includes a first data buffer 350; a random number generator 310, which is further used to store a predetermined number of generated random numbers into the first data buffer 350; an accumulator 320, which is specifically used to read a predetermined number of random numbers from the first data buffer 350, perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers, obtain multiple operation results, and store the multiple operation results into the first data buffer 350; a comparator 330, which is specifically used to obtain multiple operation results from the first data buffer 350, determine the comparison result of the multiple operation results with a predetermined reference value, and store the comparison result into the first data buffer 350; and an adder 340, which is specifically used to obtain the comparison result from the first data buffer 350, generate Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison result, and store the Poisson input values corresponding to multiple neurons into the first data buffer 350.
[0104] In this embodiment, the in-situ operation storage method is used to enable each calculation module to process in sequence, including the multiplication operation of the accumulator, the comparison operation of the comparator, and the summation operation of the adder. The data buffer only needs to store a fixed number of data, which is beneficial to improve resource utilization and reduce storage space.
[0105] like Figure 5 As shown, with Figure 3 compared to, Figure 5 The data generation device also includes a second data buffer 561, a third data buffer 562, a fourth data buffer 563, and a fifth data buffer 564.
[0106] The random number generator 310 is further configured to store a predetermined number of generated random numbers into a second data buffer 561; the accumulator 320 is specifically configured to read a predetermined number of random numbers from the second data buffer 561, perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers, obtain multiple operation results, and store the multiple operation results into a third data buffer 562; the comparator 330 is specifically configured to obtain multiple operation results from the third data buffer 562, determine the comparison result of the multiple operation results with a predetermined reference value, and store the comparison result into a fourth data buffer 563; the summer 340 is specifically configured to obtain the comparison result from the fourth data buffer 563, generate Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison result, and store the Poisson input values corresponding to multiple neurons into a fifth data buffer 564.
[0107] In this embodiment, the generation of random numbers, cumulative multiplication, comparison, and sum calculation can form a data generation pipeline. When high-throughput data generation is required, the pipelined processing through the above modules improves the generation efficiency of Poisson input values corresponding to multiple neurons in the brain simulation system.
[0108] The embodiments provided in this disclosure can generate a predetermined number of random numbers using a random number generator, perform a predetermined number of random number multiplication operations using an accumulator to obtain multiple operation results, compare these multiple operation results with a predetermined reference value using a comparator, and then generate Poisson input values corresponding to multiple neurons in a brain simulation system using an adder based on the comparison results. In this data generation device, the Poisson input values corresponding to multiple neurons in the brain simulation system are generated through the cooperation of various modules. This method helps to eliminate the limitation in related technologies where the termination of random number multiplication operations requires meeting specific stopping conditions. The scheduling logic involved in the entire operation process—random number generation, parallel random number multiplication operations, and numerical comparison—consumes less time and space, meaning the scheduling logic overhead of the entire operation process is low. By generating a set of Poisson values at once through parallel and batch operations, the generation efficiency of Poisson values corresponding to each neuron is improved. It should be noted that the present invention is not limited to the specific configurations and processes described in the above embodiments and shown in the figures. For the sake of convenience and brevity, detailed descriptions of known methods are omitted here, and the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the aforementioned method embodiments, which will not be repeated here.
[0109] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the data generation method described above. The computer-readable storage medium may be volatile or non-volatile.
[0110] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0111] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0112] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0113] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0114] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0115] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0116] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0117] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0118] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which includes one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0119] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A data generation method for brain simulation, characterized by, The method includes: In response to the received calculation instruction, a predetermined number of random numbers are generated; Based on the predetermined number of random numbers, perform random number multiplication operations in parallel a predetermined total number of times to obtain multiple operation results; Based on the comparison results of multiple calculation results with predetermined reference values, Poisson input values corresponding to multiple neurons in the brain simulation system are generated; The step of generating a predetermined number of random numbers includes: generating a random number array, wherein the random number array has N rows, and each row contains M random numbers, where N is an integer greater than 1 and M is an integer greater than 2; The process involves performing a predetermined number of random number multiplication operations in parallel based on a predetermined number of random numbers, resulting in multiple operation results, including: For N rows of random numbers, the cumulative product of M random numbers in each row is calculated in parallel; wherein the cumulative product operation for each row is performed M-1 times, resulting in M-1 cumulative product results for each row. The neurons are those used in the brain simulation application, which runs on the brain simulation system; the predetermined reference value is calculated in advance based on the pulse firing rate of the neurons and the simulation time granularity.
2. The method of claim 1, wherein, The step of generating Poisson input values for multiple neurons in the brain simulation system based on comparisons between multiple computation results and predetermined reference values includes: In parallel, the M-1 cumulative multiplication results of each of the N rows are compared with a predetermined reference value. Based on the comparison results, the M-1 cumulative multiplication results of each row are binarized to obtain M-1 binary sample data for each row; wherein the values of the binary sample data include 1 and non-1 values. Calculate the sum of the binary sample data with a value of 1 in each row to obtain the sum calculation result for each row; The sum of each row is used as the Poisson value of the corresponding row, and the Poisson value of each of the N rows is used as the Poisson input value of multiple neurons in the brain simulation system.
3. The method of claim 2, wherein, The step involves binarizing the M-1 cumulative multiplication results of each row based on the comparison results to obtain M-1 binary sample data for each row, including: In the comparison results, the cumulative multiplication result greater than the predetermined reference value is set to 1; and the cumulative multiplication result less than or equal to the predetermined reference value is set to 0.
4. The method of claim 1, wherein, The method further includes: The normalized rate of the brain simulation application is determined based on the product of the pre-obtained pulse firing rate of the neuron and the simulation time granularity. An exponential operation is performed based on the negative of the normalization rate to obtain the exponential operation result; wherein the value of the exponential operation result is greater than zero and less than 1; The result of the exponent calculation is used as the predetermined reference value.
5. The method according to claim 2, characterized in that, After generating the random number array, the method further includes: storing the random number array into a first data buffer; Before performing the parallel calculation of the cumulative product of M random numbers in each of the N rows of random numbers, the method further includes: obtaining the random number array from the first data buffer; and after obtaining the M-1 cumulative product results of each row, the method further includes: storing the M-1 cumulative product results of each row into the first data buffer. Before comparing the M-1 cumulative multiplication results of each of the N rows in parallel with a predetermined reference value, and performing binarization processing on the M-1 cumulative multiplication results of each row based on the comparison results, the method further includes: obtaining the M-1 cumulative multiplication results of each row from the first data buffer; and after obtaining the M-1 binary sample data of each row, the method further includes: storing the M-1 binary sample data of each row into the first data buffer. Before calculating the sum of the binary sample data with a value of 1 in each row, the method further includes: obtaining M-1 binary sample data of each row from the first data buffer; and after obtaining the sum calculation result of each row, the method further includes: storing the sum calculation result of each row into the first data buffer.
6. The method according to claim 2, characterized in that, After generating the random number array, the method further includes: storing the generated random number array into a second data buffer; Before performing the parallel calculation of the cumulative product of M random numbers in each of the N rows of random numbers, the method further includes: obtaining the random number array from the second data buffer; and after obtaining the M-1 cumulative product results of each row, the method further includes: storing the M-1 cumulative product results of each row into a third data buffer. Before comparing the M-1 cumulative multiplication results of each of the N rows with a predetermined reference value in parallel, and performing binarization processing on the M-1 cumulative multiplication results of each row based on the comparison results, the method further includes: obtaining the M-1 cumulative multiplication results of each row from the third data buffer; and after obtaining the M-1 binary sample data of each row, the method further includes: storing the M-1 binary sample data of each row into a fourth data buffer. Before calculating the sum of the binary sample data with a value of 1 in each row, the method further includes: obtaining M-1 binary sample data of each row from the fourth data buffer; and after obtaining the sum calculation result of each row, the method further includes: storing the sum calculation result of each row into the fifth data buffer.
7. A data generation device, characterized in that, For implementing the method as described in any one of claims 1-6, and applied to a brain simulation system, the device comprises: a random number generator, an accumulator, a comparator, and an adder; The random number generator is used to generate a predetermined number of random numbers in response to a received calculation instruction; The accumulator is used to perform random number multiplication operations in parallel a predetermined total number of times based on the predetermined number of random numbers, to obtain multiple operation results; The comparator is used to determine the comparison results of multiple calculation results with a predetermined reference value; The adder is used to generate Poisson input values for multiple neurons in the brain simulation system based on the comparison results.
8. The device according to claim 7, characterized in that, The random number generator is used to generate a random number array in response to a received calculation instruction. The random number array has N rows, and each row contains M random numbers, where N is an integer greater than 1 and M is an integer greater than 2. The accumulator is used to calculate the cumulative multiplication of M random numbers in each of the N rows in parallel; wherein the number of cumulative multiplication operations for each row is M-1, and the M-1 cumulative multiplication results for each row are obtained. The comparator is used to compare the M-1 cumulative multiplication results of each of the N rows with a predetermined reference value in parallel, and to perform binarization processing on the M-1 cumulative multiplication results of each row according to the comparison results to obtain M-1 binary sample data of each row; wherein the values of the binary sample data include 1 and non-1 values. The adder is used to calculate the sum of the binary sample data with a value of 1 in each row, obtain the sum calculation result of each row, use the sum calculation result of each row as the Poisson value of the corresponding row, and use the Poisson value corresponding to each of the N rows as the Poisson input value of multiple neurons in the brain simulation system.
9. The device according to claim 7, characterized in that, The device also includes a first data buffer; The random number generator is also used to store a predetermined number of generated random numbers into the first data buffer; The accumulator is specifically used to read the predetermined number of random numbers from the first data buffer, perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers, obtain multiple operation results, and store the multiple operation results into the first data buffer. The comparator is specifically used to obtain the plurality of operation results from the first data buffer, determine the comparison results of the plurality of operation results with a predetermined reference value, and store the comparison results into the first data buffer; The adder is specifically used to obtain the comparison result from the first data buffer, generate Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison result, and store the Poisson input values corresponding to the multiple neurons into the first data buffer.
10. The device according to claim 7, characterized in that, The device further includes a second data buffer, a third data buffer, a fourth data buffer, and a fifth data buffer; The random number generator is also used to store a predetermined number of generated random numbers into the second data buffer; The accumulator is specifically used to read the predetermined number of random numbers from the second data buffer, perform a predetermined number of random number multiplication operations in parallel based on the predetermined number of random numbers, obtain multiple operation results, and store the multiple operation results into the third data buffer; The comparator is specifically used to obtain the plurality of operation results from the third data buffer, determine the comparison results of the plurality of operation results with a predetermined reference value, and store the comparison results into the fourth data buffer; The adder is specifically used to obtain the comparison result from the fourth data buffer, generate Poisson input values corresponding to multiple neurons in the brain simulation system based on the comparison result, and store the Poisson input values corresponding to the multiple neurons into the fifth data buffer.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data generation method as described in any one of claims 1-6.