A parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm

By employing parallel computing methods, combined with dynamic weight load balancing and feature peak similarity analysis optimization, the problems of high computational load and low efficiency in NMR spectrum feature peak similarity analysis algorithms are solved, achieving efficient multi-threaded analysis.

CN116339986BActive Publication Date: 2026-01-30CHONGQING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310255769.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-16
Publication Date
2026-01-30
Estimated Expiration
2043-03-16

AI Technical Summary

Technical Problem

Existing NMR spectrum peak similarity analysis algorithms are computationally intensive and time-consuming. Traditional single-threaded serial algorithms cannot meet the computing requirements of multi-core hardware, resulting in resource waste and low analysis efficiency.

Method used

Parallel computing is employed, cluster node hardware information is obtained through a service registry, a dynamic weighted load balancing strategy is designed to allocate tasks reasonably, and feature peak data is divided and optimized for analysis. The main thread and child threads communicate to perform feature peak similarity matching and result aggregation.

Benefits of technology

The efficiency of NMR spectrum characteristic peak similarity analysis has been improved, and the load balancing and characteristic peak similarity analysis algorithms have been optimized to make them suitable for multi-threaded scenarios, thereby improving computer resource utilization and analysis speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339986B_ABST
    Figure CN116339986B_ABST
Patent Text Reader

Abstract

This invention claims protection for a parallel computing method for NMR spectrum feature peak similarity analysis algorithms, belonging to the field of deep learning. The method includes: S1: The server hosting Consul calculates the initial circles of nodes in the server cluster based on the server cluster; S2: The server hosting Ribbon periodically obtains the hardware information of the cluster servers and then dynamically updates the weights based on the hardware information and the initial weights; S3: When a task needs analysis and calculation, Ribbon reasonably allocates the task to the nodes in the cluster based on the values ​​of the dynamic weights; S4: The node servers in the cluster reasonably divide the NMR spectrum feature peak data and assign it to different sub-threads for analysis and calculation; S5: After the sub-threads complete their analysis and calculation, the main thread summarizes the results of the sub-threads and returns them to the user. This paper uses a parallel computing model for NMR spectrum feature peak similarity analysis algorithms, improving the analysis efficiency of the test sample.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of parallel computing, specifically relating to a parallel computing strategy for analyzing the similarity of characteristic peaks in nuclear magnetic resonance spectra. Background Technology

[0002] With the rapid rise of various precision instruments and high-precision equipment, the market demands increasingly diverse performance and higher quality lubricants. To meet the lubrication requirements of special operating conditions, various types of lubricant additives are being used synergistically to improve the physical and chemical properties of lubricants. Research on lubricant additives can be traced back to the 1970s. In the past 60 years, the growth rate of lubricant additive usage has far outpaced the growth rate of lubricant products. However, research on lubricant additives has become a key focus and challenge in the lubrication field. Recent research has revealed the emergence of nanoparticle-level lubricant additives. It is worth noting that lubricant additives are numerous and varied. Although they constitute only a tiny fraction of the lubricant, they play a crucial role, and it is difficult to identify the additives used from the appearance of the oil. Therefore, when lubricant labels are invalid or lost, it can lead to confusion and difficulty in management, resulting in economic losses. Furthermore, identifying the types of additives in residual oil, waste oil, and leaks from operating equipment can help factories and research institutes conduct equipment health checks and provide early warnings for equipment maintenance. This paper, after studying the problems analyzed above, finds that a rapid and accurate method for simultaneous identification of lubricating oil additives can not only reduce losses but also identify the components of lubricating oil, enabling the production of more efficient and user-friendly lubricating oils. Currently, there are relatively few research results on the component analysis of lubricating oil additives, especially on peak identification algorithms based on characteristic peaks in NMR spectra. Characteristic peaks, as absorption peaks used to identify the presence of chemical bonds or groups, are widely used in material detection and analysis. Increasingly, researchers are using characteristic peak information as a crucial factor in determining the presence of lubricating oil additives. Therefore, this paper, after studying traditional component detection methods for lubricating oil additives, hopes to achieve analytical detection of lubricating oil additives through this approach.

[0003] The proposed NMR spectrum-based characteristic peak similarity analysis algorithm is complex and computationally intensive, consuming significant time and effort for researchers. High-performance computing (HPC) offers an immediate solution to these problems, but it is merely one method to accelerate problem-solving. In the development of computers and HPC, numerous HPC-based computing methods have emerged, such as grid computing based on shared components, web service-based visualization computing, and the widely used cloud computing. These HPC strategies primarily address problems with high computational demands and performance requirements. However, with the iteration and development of multi-core, multi-threaded servers, traditional single-threaded serial algorithms are no longer sufficient to meet researchers' analytical needs. Furthermore, serial algorithms are a waste of multi-core hardware, wasting computer resources and failing to improve execution efficiency. The underlying idea of ​​high-performance computing is to improve algorithm performance through parallel computing strategies, thereby unlocking the potential of computers. Parallel computing technology has been applied in various industries and has achieved excellent results in the process, such as high-tech fields that require high timeliness and rapid analysis and judgment in a short period of time, such as robotic systems, facial recognition and autonomous driving. Summary of the Invention

[0004] This invention aims to solve the problems of the prior art. It proposes a parallel computation method for NMR spectrum characteristic peak similarity analysis algorithms. The technical solution of this invention is as follows:

[0005] A parallel computation method for NMR spectrum characteristic peak similarity analysis algorithms includes the following steps:

[0006] Step 1: Design steps for initial weights:

[0007] Step 2: The server hosting the service registry (Consul) periodically retrieves the hardware usage information of the nodes in the cluster;

[0008] Step 3: The server where Consul is located will periodically push the hardware information of each node in the cluster to the server where the load balancer (Ribbon) is located through a heartbeat mechanism.

[0009] Step 4: The server where Ribbon is located calculates dynamic weights based on the hardware usage of each node in the cluster, using the initial weights as a basis.

[0010] Step 5: Whenever a task arrives, allocate the task reasonably according to the weight of each node in the current cluster;

[0011] Step 6: After the task is assigned to a specific server, the application's main thread will divide the NMR spectrum characteristic peak data reasonably according to the number of CPU cores.

[0012] Step 7: The child threads analyze and calculate the data for their respective areas. The main thread communicates with the child threads according to the analysis steps.

[0013] Step 8: After all the analysis tasks are completed, the analysis results will be summarized and fed back again.

[0014] Furthermore, the design step of initial weights in step 1 specifically includes:

[0015] A1. Calculate the sum of the CPU, memory, and disk I / O performance of the server nodes based on the hardware information of the nodes in the cluster;

[0016] A2. The weight of a single node in the cluster is the performance of the single node in a certain hardware aspect divided by the sum of the hardware performance of all nodes in the cluster in that aspect, and then multiplied by the weight of each aspect of hardware performance on the server performance.

[0017] A3. Describe the server's hardware configuration and response time using a correlation coefficient;

[0018] A4. Calculate the expected proportion of CPU, memory, and disk I / O of nodes in the cluster with their hardware information in the cluster. The result of the calculation is the initial weight of the hardware.

[0019] A5. The relational rate of the hardware information of the nodes in the cluster is processed by normalization.

[0020] Furthermore, the formula for calculating the initial weights in step 1 is as follows:

[0021]

[0022] In the formula, P c (j) represents the static CPU performance of the nodes in the cluster, P m (j) represents the static memory performance of the nodes in the cluster, P i (j) represents the static disk I / O performance of the nodes in the cluster, P c (Total) represents the sum of static CPU performance in the cluster, P m (Total) represents the sum of static memory performance in the cluster, P i (Total) represents the sum of static disk I / O performance in the cluster, W c W represents the CPU weight coefficient of the nodes in the cluster. m W represents the memory weight coefficient of the nodes in the cluster. i SW represents the disk I / O weighting coefficient for nodes in the cluster.j Let SW be the initial weight of node j relative to all nodes in the cluster, and A be the amplification factor used to adjust SW. j The value;

[0023] Furthermore, the specific calculation process for the CPU weighting coefficient is as follows:

[0024] 1) Calculate the correlation coefficient of the CPUs of the nodes in the cluster according to formula (2);

[0025]

[0026] In the formula, i represents a certain period of a node in the cluster, n represents the number of periods of a node in the cluster, and X... i Let be the CPU utilization of the nodes in the cluster during the i-th cycle. Y represents the average utilization rate of nodes in the cluster. i Let be the response time of the node in the i-th cycle in the cluster. It is the average response time of the nodes in the cluster.

[0027] 2) Calculate the average CPU weight coefficient of the nodes in the cluster according to formula (3);

[0028]

[0029] In the formula, P c (j) represents the CPU information and P of node j. c (total) CPU information for all nodes in the cluster.

[0030] (2) Calculate the remaining load rate of each node based on the remaining hardware of the nodes in the cluster. The specific calculation formula is as follows:

[0031]

[0032] In the formula, C sy (j) represents the remaining CPU utilization of node j in the cluster, M sy (j) represents the remaining memory utilization of node j in the cluster, W io (j) represents the remaining disk I / O utilization of node j in the cluster, W cpu (j) represents the covariance of CPU and response time of node j in the cluster, W mem (j) represents the memory and response time covariance of node j in the cluster, W io (j) represents the disk I / O and response time covariance of node j in the cluster.

[0033] (3) Finally, based on the initial weights and remaining load rates of the nodes in the cluster in formula (5), the final weights of the nodes are calculated. The specific calculation formula is as follows:

[0034] DW(j)=W*SW(j)*L(j) (5)

[0035] Furthermore, in step A3, the server's hardware configuration and response time are described using a correlation coefficient. The specific process is as follows:

[0036] B1. Calculate the covariance between the hardware information and response time of nodes in the cluster;

[0037] B2. Calculate the covariance of CPU, memory, disk I / O, and response time for each node in the cluster.

[0038]

[0039] In the formula, cov(X) cpu Y) represents the covariance, CPU variance of nodes in the cluster, This represents the variance of the response time of the nodes in the cluster.

[0040] Furthermore, in step 4, the server where Ribbon resides will calculate dynamic weights based on the initial weights according to the hardware usage of each node in the cluster. The specific steps are as follows:

[0041] C1. Calculate the total CPU, memory, and disk I / O in the cluster based on the remaining hardware information of the nodes in the cluster;

[0042] C2. Calculate the remaining load based on the hardware utilization of the nodes in the cluster, the hardware performance of the nodes in the cluster, and the average hardware performance of the nodes in the cluster.

[0043] C3. Calculate the remaining load capacity of node j based on the remaining load of node j in the cluster.

[0044] Furthermore, in step 7, the sub-threads analyze and calculate the data for their respective responsible areas. The main thread communicates with the sub-threads according to the analysis steps. The specific analysis steps are as follows:

[0045] D1. Divide the correlation data of characteristic peaks in the NMR spectrum, and when dividing the intervals, consider the number of CPU cores and add an error ω to the left and right of each interval. Use the value of ω to eliminate the error in the analysis results caused by the transition phenomenon.

[0046] D2. The sub-thread performs a DTW feature peak similarity matching algorithm on the sample to be tested and known substances based on the data in its own region.

[0047] D3. Standardize the characteristic peak area of ​​the extracted characteristic peak data;

[0048] D4. After matching the characteristic peaks of the sample to be tested with those of known substances and performing data preprocessing, perform parallel calculation of the peak area ratio of the two samples.

[0049] D5. The main thread will summarize and statistically analyze the results of the calculations.

[0050] Furthermore, in step D2, the sub-thread performs a DTW feature peak similarity matching algorithm on the sample to be tested and known substances based on the data of its own region. The specific process of the matching algorithm is as follows:

[0051] D21. The main thread allocates a shared area to store whether the sample to be tested appears at the chemical shift corresponding to the maximum peak intensity of a known substance.

[0052] D22. When the sub-thread is performing the feature peak similarity matching algorithm, find the chemical shift corresponding to the maximum peak intensity of the known substances in each region, and determine whether the sample to be tested has a feature peak at this chemical shift.

[0053] D23. After obtaining the analysis results from D22, the sub-thread compares the results with the values ​​in the shared region. The comparison rule is: if the maximum peak intensity value in the shared region is greater than the analysis result value, the result of the shared region is retained; if the maximum peak intensity value in the shared region is less than the maximum peak intensity value of the analysis result, the value of the shared region is replaced with the analysis result of the sub-thread.

[0054] D24. After all sub-threads have completed their analysis and judgment, the main thread summarizes the results. The summarized results reflect whether the sample under test has a characteristic peak at the chemical shift corresponding to the maximum peak intensity of the known substance.

[0055] Furthermore, in step D3, the extracted feature peak data is standardized by the feature peak area. The specific parallel strategy is as follows:

[0056] D31. Each child thread uses heap sort to find the median of its current region.

[0057] D32. The main thread calculates the median of the child threads and finds the median of all characteristic peaks based on the calculated values.

[0058] D33. After obtaining the median of the characteristic peak, the sub-thread normalizes the area of ​​the characteristic peak based on the median. The normalized value is the basis for subsequent calculations.

[0059] Furthermore, in step D4, after matching the characteristic peaks of the sample to be tested with those of known substances and performing data preprocessing, the peak area ratio of the two substances is calculated in parallel. The specific analysis process is as follows:

[0060] D41. Sub-threads calculate the sum of the areas of the known substance and the sample to be tested in each region respectively;

[0061] D42. After obtaining the calculation results from the child thread, the main thread calculates the total area of ​​the known substance and the sample to be tested respectively.

[0062] D43. The sub-thread will calculate the peak ratio match rate between the sample to be tested and each characteristic peak of the known substances based on the above calculation results.

[0063] D44. The main thread will calculate the sum based on the peak area ratio of the sample to be tested and the known substances calculated by each sub-thread.

[0064] D45. After obtaining the peak area ratio matching rate, in order to avoid a low-probability event, the value of the peak area ratio matching rate is tested by variance.

[0065] D46. The main thread will also calculate the standard deviation of the peak area ratio matching rate based on the analysis and calculation results of the child thread.

[0066] The advantages and beneficial effects of this invention are as follows:

[0067] 1. This invention improves the characteristic peak similarity analysis algorithm of NMR spectra by using common parallel computing strategies. It mainly proposes and improves the algorithm from two aspects: the load balancing strategy of Ribbon and the optimization of the characteristic peak similarity analysis algorithm itself. The improved characteristic peak similarity analysis algorithm has higher analysis efficiency.

[0068] 2. The improved load balancing strategy of Ribbon utilizes the hardware information of the server cluster nodes. By analyzing the relationship between hardware information and response time in the cluster, a load balancing strategy based on dynamic weights is designed. This strategy can periodically update the load balancing weights based on hardware information, helping the server cluster find suitable servers for subsequent analysis and calculation.

[0069] 3. The optimization of the feature peak similarity analysis algorithm mainly involves rationally dividing the feature peak data in the main thread and optimizing the algorithm itself to make it more suitable for multi-threaded applications. Different sub-threads use the optimized feature peak similarity analysis algorithm on the divided regions, making the analysis algorithm more reasonable and efficient. Attached Figure Description

[0070] Figure 1 This is a general framework diagram of the load balancing strategy based on dynamic weights provided by the present invention.

[0071] Figure 2 This is a schematic diagram of the improved structure of the feature peak similarity analysis algorithm of the present invention;

[0072] Figure 3 This is a flowchart illustrating the parallel computation process of an algorithm for analyzing the similarity of characteristic peaks in NMR spectra. Detailed Implementation

[0073] The technical solutions of the embodiments of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings. The described embodiments are merely some embodiments of the present invention.

[0074] The technical solution of the present invention to solve the above-mentioned technical problems is:

[0075] like Figure 3 As shown, a parallel computing method for NMR spectrum characteristic peak similarity analysis algorithm includes the following steps:

[0076] Step 1: Design steps for initial weights:

[0077] Step 2: The server hosting the service registry (Consul) periodically retrieves the hardware usage information of the nodes in the cluster;

[0078] Step 3: The server where Consul is located will periodically push the hardware information of each node in the cluster to the server where the load balancer (Ribbon) is located through a heartbeat mechanism.

[0079] Step 4: The server where Ribbon is located calculates dynamic weights based on the hardware usage of each node in the cluster, using the initial weights as a basis.

[0080] Step 5: Whenever a task arrives, allocate the task reasonably according to the weight of each node in the current cluster;

[0081] Step 6: After the task is assigned to a specific server, the application's main thread will divide the NMR spectrum characteristic peak data reasonably according to the number of CPU cores.

[0082] Step 7: The child threads analyze and calculate the data for their respective areas. The main thread communicates with the child threads according to the analysis steps.

[0083] Step 8: After all the analysis tasks are completed, the analysis results will be summarized and fed back again.

[0084] Preferably, the design step of initial weights in step 1 specifically includes:

[0085] A1. Calculate the sum of the CPU, memory, and disk I / O performance of the server nodes based on the hardware information of the nodes in the cluster;

[0086] A2. The weight of a single node in the cluster is the performance of the single node in a certain hardware aspect divided by the sum of the hardware performance of all nodes in the cluster in that aspect, and then multiplied by the weight of each aspect of hardware performance on the server performance.

[0087] A3. Describe the server's hardware configuration and response time using a correlation coefficient;

[0088] A4. Calculate the expected proportion of CPU, memory, and disk I / O of nodes in the cluster with their hardware information in the cluster. The result of the calculation is the initial weight of the hardware.

[0089] A5. The relational rate of the hardware information of the nodes in the cluster is processed by normalization.

[0090] Preferably, the formula for calculating the initial weights in step 1 is:

[0091]

[0092] In the formula, P c (j) represents the static CPU performance of the nodes in the cluster, P m (j) represents the static memory performance of the nodes in the cluster, P i (j) represents the static disk I / O performance of the nodes in the cluster, P c (Total) represents the sum of static CPU performance in the cluster, P m (Total) represents the sum of static memory performance in the cluster, P i (Total) represents the sum of static disk I / O performance in the cluster, W c W represents the CPU weight coefficient of the nodes in the cluster. m W represents the memory weight coefficient of the nodes in the cluster. i SW represents the disk I / O weighting coefficient for nodes in the cluster. j Let SW be the initial weight of node j relative to all nodes in the cluster, and A be the amplification factor used to adjust SW. j The value;

[0093] Preferably, the specific calculation process for the CPU weighting coefficient is as follows:

[0094] 1) Calculate the correlation coefficient of the CPUs of the nodes in the cluster according to formula (2);

[0095]

[0096] In the formula, i represents a certain period of a node in the cluster, n represents the number of periods of a node in the cluster, and X... i Let be the CPU utilization of the nodes in the cluster during the i-th cycle. Y represents the average utilization rate of nodes in the cluster.i Let be the response time of the node in the i-th cycle in the cluster. It is the average response time of the nodes in the cluster.

[0097] 2) Calculate the average CPU weight coefficient of the nodes in the cluster according to formula (3);

[0098]

[0099] P c (j) represents the CPU information and P of node j. c (total) CPU information for all nodes in the cluster.

[0100] (2) Calculate the remaining load rate of each node based on the remaining hardware of the nodes in the cluster. The specific calculation formula is as follows:

[0101]

[0102] C sy (j) represents the remaining CPU utilization of node j in the cluster, M sy (j) represents the remaining memory utilization of node j in the cluster, W io (j) represents the remaining disk I / O utilization of node j in the cluster, W cpu (j) represents the covariance of CPU and response time of node j in the cluster, W mem (j) represents the memory and response time covariance of node j in the cluster, W io (j) represents the disk I / O and response time covariance of node j in the cluster.

[0103] (3) Finally, based on the initial weights and remaining load rates of the nodes in the cluster in formula (5), the final weights of the nodes are calculated. The specific calculation formula is as follows:

[0104] DW(j)=W*SW(j)*L(j) (5)

[0105] Preferably, step A3, describing the server's hardware status and response time using a correlation coefficient, is as follows:

[0106] B1. Calculate the covariance between the hardware information and response time of nodes in the cluster;

[0107] B2. Calculate the covariance of CPU, memory, disk I / O, and response time for each node in the cluster.

[0108]

[0109] In the formula, cov(X) cpu Y) represents the covariance, CPU variance of nodes in the cluster, This represents the variance of the response time of the nodes in the cluster.

[0110] Preferably, in step 4, the server where Ribbon resides calculates dynamic weights based on the initial weights according to the hardware usage of each node in the cluster. The specific steps are as follows:

[0111] C1. Calculate the total CPU, memory, and disk I / O in the cluster based on the remaining hardware information of the nodes in the cluster;

[0112] C2. Calculate the remaining load based on the hardware utilization of the nodes in the cluster, the hardware performance of the nodes in the cluster, and the average hardware performance of the nodes in the cluster.

[0113] C3. Calculate the remaining load capacity of node j based on the remaining load of node j in the cluster.

[0114] Preferably, in step 7, the sub-threads analyze and calculate the data for their respective responsible areas. The main thread communicates with the sub-threads according to the analysis steps. The specific analysis steps are as follows:

[0115] D1. Divide the correlation data of characteristic peaks in the NMR spectrum, and when dividing the intervals, consider the number of CPU cores and add an error ω to the left and right of each interval. Use the value of ω to eliminate the error in the analysis results caused by the transition phenomenon.

[0116] D2. The sub-thread performs a DTW feature peak similarity matching algorithm on the sample to be tested and known substances based on the data in its own region.

[0117] D3. Standardize the characteristic peak area of ​​the extracted characteristic peak data;

[0118] D4. After matching the characteristic peaks of the sample to be tested with those of known substances and performing data preprocessing, perform parallel calculation of the peak area ratio of the two samples.

[0119] D5. The main thread will summarize and statistically analyze the results of the calculations.

[0120] Preferably, in step D2, the sub-thread performs a DTW feature peak similarity matching algorithm on the sample to be tested and known substances based on the data of its own region. The specific process of the matching algorithm is as follows:

[0121] D21. The main thread allocates a shared area to store whether the sample to be tested appears at the chemical shift corresponding to the maximum peak intensity of a known substance.

[0122] D22. When the sub-thread is performing the feature peak similarity matching algorithm, find the chemical shift corresponding to the maximum peak intensity of the known substances in each region, and determine whether the sample to be tested has a feature peak at this chemical shift.

[0123] D23. After obtaining the analysis results from D22, the sub-thread compares the results with the values ​​in the shared region. The comparison rule is: if the maximum peak intensity value in the shared region is greater than the analysis result value, the result of the shared region is retained; if the maximum peak intensity value in the shared region is less than the maximum peak intensity value of the analysis result, the value of the shared region is replaced with the analysis result of the sub-thread.

[0124] D24. After all sub-threads have completed their analysis and judgment, the main thread summarizes the results. The summarized results reflect whether the sample under test has a characteristic peak at the chemical shift corresponding to the maximum peak intensity of the known substance.

[0125] Preferably, in step D3, the extracted feature peak data is standardized by the feature peak area. The specific parallel strategy is as follows:

[0126] D31. Each child thread uses heap sort to find the median of its current region.

[0127] D32. The main thread calculates the median of the child threads and finds the median of all characteristic peaks based on the calculated values.

[0128] D33. After obtaining the median of the characteristic peak, the sub-thread normalizes the area of ​​the characteristic peak based on the median. The normalized value is the basis for subsequent calculations.

[0129] Preferably, in step D4, after matching the characteristic peaks of the sample to be tested with those of known substances and performing data preprocessing, the peak area ratio of the two substances is calculated in parallel. The specific analysis process is as follows:

[0130] D41. Sub-threads calculate the sum of the areas of the known substance and the sample to be tested in each region respectively;

[0131] D42. After obtaining the calculation results from the child thread, the main thread calculates the total area of ​​the known substance and the sample to be tested respectively.

[0132] D43. The sub-thread will calculate the peak ratio match rate between the sample to be tested and each characteristic peak of the known substances based on the above calculation results.

[0133] D44. The main thread will calculate the sum based on the peak area ratio of the sample to be tested and the known substances calculated by each sub-thread.

[0134] D45. After obtaining the peak area ratio matching rate, in order to avoid a low-probability event, the value of the peak area ratio matching rate is tested by variance.

[0135] D46. The main thread will also calculate the standard deviation of the peak area ratio matching rate based on the analysis and calculation results of the child thread.

[0136] 1. As attached Figure 1 As shown, when a user sends an analysis request from the terminal, Ribbon distributes the analysis request appropriately to the servers in the cluster according to the load balancing strategy:

[0137] (1) The user sends the information of the sample to be tested and multiple known substances to be compared to the Ribbon server;

[0138] (2) Ribbon’s load balancing strategy will allocate different known substances to different servers based on dynamic weights to perform feature peak similarity analysis calculation.

[0139] (3) After the sample to be tested has completed the similarity analysis calculation with all known substances, the service consumer will assemble the return values ​​of the nodes in the cluster and then return them to the client.

[0140] The dynamic weight calculation process described above is as follows:

[0141] (1) When calculating the initial weights, this paper mainly considers the hardware performance of the cluster nodes. Then, based on the different impacts of various hardware performances on the server, the various hardware performance indicators are weighted to make the weights of each hardware more reasonable. The specific calculation formula is as follows:

[0142]

[0143] In the formula, P c (j) represents the static CPU performance of the nodes in the cluster, P m (j) represents the static memory performance of the nodes in the cluster, P i (j) represents the static disk I / O performance of the nodes in the cluster, P c (Total) represents the sum of static CPU performance in the cluster, P m (Total) represents the sum of static memory performance in the cluster, P i (Total) represents the sum of static disk I / O performance in the cluster, W c W represents the CPU weight coefficient of the nodes in the cluster. m W represents the memory weight coefficient of the nodes in the cluster. i SW represents the disk I / O weighting coefficient for nodes in the cluster. j Let j be the initial weight of node j relative to all nodes in the cluster.

[0144] The CPU weight coefficient, memory weight coefficient, and disk I / O weight coefficient in the formula are calculated based on the hardware information and average response time of each node in the cluster. Let's take the CPU weight coefficient calculation as an example; the specific calculation process is as follows:

[0145] 1) Calculate the correlation coefficient of the CPUs of the nodes in the cluster according to Formula 2;

[0146]

[0147] 2) Calculate the average CPU weight coefficient of the nodes in the cluster according to Formula 3.

[0148]

[0149] (2) Calculate the remaining load rate of each node based on the remaining hardware of the nodes in the cluster. The specific calculation formula is as follows:

[0150]

[0151] (3) Finally, based on the initial weights and remaining load rates of the nodes in the cluster according to Formula 5, the final weights of the nodes are calculated. The specific calculation formula is as follows:

[0152] DW(j)=W*SW(j)*L(j) (5)

[0153] 2. As attached Figure 2 As shown, the optimization strategy for the characteristic peak similarity analysis of NMR spectra is as follows:

[0154] (1) After receiving the corresponding analysis task, the nodes in the cluster will divide the characteristic peak data into reasonable intervals according to the number of CPU cores of the node. The specific division logic is: assuming that the number of CPU cores is 4, the chemical shift of the sample to be tested is within the range of [-18.3153, 193.9489]. Therefore, according to the rules described above, the characteristic peak intervals can be divided into four parts: [-18.3153, 34.7507], [34.7507, 87.8167], [87.8167, 140.8828], and [140.8828, 193.9489]. However, considering the chemical shift offset of 0.1, the above intervals are modified as follows: [-18.3153, 34.8507], [34.6507, 87.9167], [87.7167, 140.9828], and [141.7828, 193.9489]. The subsequent data division for substance detection is carried out according to this rule.

[0155] (2) After the interval is divided, each sub-thread performs the NMR spectrum feature peak similarity matching algorithm on the data of its own interval. The specific process is as follows: extract feature peaks using the optimized feature peak similarity matching algorithm and determine whether the sample to be tested has a feature peak at the chemical shift corresponding to the maximum peak intensity of the known substance, parallel data preprocessing stage, parallel verification of chemical shift matching rate, feature peak area ratio matching rate and feature peak area ratio matching rate.

[0156] (3) The main thread summarizes the analysis results of the child threads and returns the analysis and calculation results to the client or stores them on the corresponding storage server.

[0157] This invention aims to improve the feature peak similarity matching algorithm of NMR spectra by utilizing parallel computing strategies, and optimizes the similarity matching algorithm to enable parallel analysis. First, a load balancing algorithm based on dynamic weights is designed using Ribbon. This algorithm updates the weights according to the initial hardware information and hardware usage of the servers, maximizing the resource utilization of the cluster. Then, the feature peak similarity analysis algorithm is optimized and decomposed to make it applicable to multi-threaded scenarios. Finally, after all threads and servers have completed the analysis and calculation, the analysis and calculation results are summarized and returned to the client for researchers to judge the results.

[0158] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0159] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0160] The above embodiments should be understood as illustrative only and not as limiting the scope of protection of the present invention. After reading the description of the present invention, those skilled in the art can make various alterations or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.

Claims

1. A parallel computing method for nuclear magnetic spectrum feature peak similarity analysis algorithm, characterized in that, Comprise the following steps: Step 1, the initial weight design step: Step 2, the server where the service registry center Consul is located periodically obtains the hardware usage of the nodes in the cluster; Step 3, the server where Consul is located will periodically push the hardware information of the nodes in the cluster to the server where the load balancing scheduler Ribbon is located through the heartbeat mechanism; Step 4, the server where Ribbon is located calculates the dynamic weight based on the initial weight according to the hardware usage of the nodes in the cluster; Step 5, whenever a task arrives, the task is reasonably allocated according to the weight of each node in the current cluster; Step 6, after the task is allocated to a specific server, the main thread of the application will reasonably divide the nuclear magnetic resonance spectrum feature peak data according to the number of CPU cores; Step 7, the sub-thread analyzes and calculates the regional data it is responsible for, and the main thread communicates with the sub-thread according to the analysis steps, Step 8, after all the analysis tasks are completed, the analysis results are summarized and fed back again; Said step 7, the sub-thread analyzes and calculates the regional data it is responsible for, and the main thread communicates with the sub-thread according to the analysis steps, the specific analysis steps are as follows: D1, dividing the characteristic peak related data of the nuclear magnetic spectrum, and considering the number of cores of the CPU when dividing the interval and adding an error to the left and right of each interval when dividing the interval , by the value of the transition phenomenon to eliminate the analysis result error caused by the transition phenomenon; D2, the sub-thread performs DTW feature peak similarity matching algorithm on the data in its own region for the sample to be tested and the known substance, D3, standardize the feature peak area of the extracted feature peak data; D4, after feature peak matching and data preprocessing for the sample to be tested and the known substance, perform parallel calculation of the peak area proportion coincidence rate of the feature peak area of the two; D5, the main thread will summarize and count the results of the analysis and calculation.

2. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 1, characterized in that, Said step 1, the initial weight design step specifically includes: A1, calculate the sum of CPU, memory and disk I / O performance of the server nodes according to the hardware information of the nodes in the cluster; A2, the weight of a single node in the cluster is the performance of a single node in a certain hardware aspect divided by the sum of the hardware performance of all nodes in the cluster in this aspect, and then multiplied by the proportion weight of the hardware performance aspect on the server performance; A3, describe the hardware condition and response time of the server through the correlation coefficient; A4, calculate the expectation of the CPU, memory and disk I / O of the nodes in the cluster and the proportion of their hardware information in the cluster, and the result of the calculation is the initial weight of the hardware; A5, normalize the relationship rate of the hardware information of the nodes in the cluster.

3. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 2, characterized in that, The calculation formula of the initial weight in step 1 is: (1) wherein, is the static CPU performance of a node in the cluster, is the static memory performance of a node in the cluster, is the static disk I / O performance of a node in the cluster, is the sum of the static CPU performance in the cluster, is the sum of the static memory performance in the cluster, is the sum of the static disk I / O performance in the cluster, is the CPU weight coefficient of a node in the cluster, is the memory weight coefficient of a node in the cluster, is the disk I / O weight coefficient of a node in the cluster, is the node occupies the initial weight of all nodes in the cluster, is the amplification coefficient used to adjust the value.

4. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 2, characterized in that, The specific calculation process of the weight coefficient of CPU is as follows: 1) Calculate the correlation coefficient of the CPU of the nodes in the cluster according to formula (2); (2) where i is a certain cycle of a node in the cluster, n is the number of cycles of the node in the cluster, is the CPU usage rate of the i th cycle of a node in the cluster, is the average usage rate of a node in the cluster, is the response time of the i th cycle of a node in the cluster, is the average response time of a node in the cluster; 2) Calculate the average weight coefficient of the CPU of the nodes in the cluster according to formula (3); (3) CPU information for node j, CPU information for all nodes in the cluster; (2) Calculate the residual load rate of each node according to the hardware residual condition of the nodes in the cluster, and the specific calculation formula is as follows: (4) RjCPU, the remaining CPU usage of node j in the cluster, RjMem, the remaining memory usage of node j in the cluster, RjDisk, the remaining disk I / O usage of node j in the cluster, Cj, the CPU and response time covariance of node j in the cluster, Mj, the memory and response time covariance of node j in the cluster, Dj, the disk I / O and response time covariance of node j in the cluster; (3) Finally, calculate the maximum weight size of the node according to the initial weight of the node in the cluster and the residual load rate according to formula (5), and the specific calculation formula is as follows: (5)。 5. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 2, characterized in that, Said step A3, describe the hardware condition and response time of the server through the correlation coefficient, and the specific process is as follows: B1, calculate the covariance of the hardware information and response time of the nodes in the cluster; B2, calculate the covariance of the CPU, memory, disk I / O and response time of each node in the cluster; (6) wherein is the covariance, is the CPU variance of the nodes in the cluster, is the variance of the response times of the nodes in the cluster.

6. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 1, characterized in that, The step 4, the server where the Ribbon is located calculates the dynamic weight based on the initial weight according to the hardware usage of the nodes in the cluster, and the specific steps are as follows: C1, calculate the sum of CPU, memory and disk I / O in the cluster according to the remaining hardware information of the nodes in the cluster; C2, calculate the remaining load according to the hardware usage rate of the nodes in the cluster, the hardware performance of the nodes in the cluster and the average hardware performance of the nodes in the cluster; C3. Calculate the remaining load capacity of the node based on the remaining load capacity of the nodes in the cluster. C4. Calculate the remaining load capacity of the node based on the remaining load capacity of the nodes in the cluster. C5. Calculate the remaining load capacity of the node based on the remaining load 7. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 1, characterized in that, The step D2, the sub-thread carries out the DTW feature peak similarity matching algorithm based on the data of its own region for the sample to be tested and the known substance, and the specific process of the matching algorithm is as follows: D21, the main thread opens a shared region for storing the value of whether the sample to be tested appears at the chemical shift corresponding to the maximum peak intensity of the known substance; D22, when the sub-thread carries out the feature peak similarity matching algorithm, find the chemical shift corresponding to the maximum peak intensity of the known substance in each region, and judge whether the sample to be tested appears a feature peak at the chemical shift; D23, after the sub-thread gets the analysis result of D22, compare the result with the value of the shared region, and the comparison rule is: if the value of the maximum peak intensity in the shared region is greater than the value of the analysis result, keep the result of the shared region; if the value of the maximum peak intensity in the shared region is less than the maximum peak intensity of the analysis result, replace the value of the shared region with the analysis result of the analysis sub-thread; D24, after all the sub-threads complete the analysis and judgment, the main thread summarizes the results, and the summarized results can reflect the experimental results of whether the sample to be tested appears a feature peak at the chemical shift corresponding to the maximum peak intensity of the known substance.

8. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 1, characterized in that, The step D3, normalize the feature peak area of the extracted feature peak data, and the specific parallel strategy is as follows: D31, the sub-thread respectively finds the median of the current region by heap sorting for its own region; D32, the main thread statistically analyzes the medians of the sub-threads, and finds the median of all feature peaks based on the statistical value; D33, after the sub-thread gets the median of the feature peak, the median is used to normalize the area of the feature peak, and the normalized value is the basis for subsequent calculation.

9. The parallel computing method for nuclear magnetic resonance spectrum feature peak similarity analysis algorithm according to claim 1, characterized in that, The step D4, after the feature peak matching and data preprocessing of the sample to be tested and the known substance, the peak area proportion coincidence rate of the feature peak area of the two is calculated in parallel, and the specific analysis process is as follows: D41, the sub-thread respectively calculates the sum of the areas of the known substance and the sample to be tested in each region; D42, after the main thread gets the calculation results of the sub-threads, the main thread respectively calculates the total area of the known substance and the sample to be tested; D43, the sub-thread calculates the peak proportion coincidence rate of each feature peak of the sample to be tested and the known substance according to the calculation results; D44, the main thread calculates the sum of the peak area proportion coincidence rates of the sample to be tested and the known substance according to the calculation results of each sub-thread. D45. After obtaining the peak area ratio matching rate, in order to avoid a low-probability event, the value of the peak area ratio matching rate is tested by variance. D46. The main thread will also calculate the standard deviation of the peak area ratio matching rate based on the analysis and calculation results of the child thread.

Citation Information

Patent Citations

  • Method and system for efficiently traversing set with large data volume, terminal and storage medium

    CN110554917A

  • Dynamic weight load balancing method based on Nginx

    CN111381971A