Section Insights
Introduction to Shallow Recurrent Decoders at Scale
What is the focus of the video series?
The video series aims to explain how to perform shallow recurrent decoders at scale using parallel computing techniques.
- The presenter is from the Barca supercomputing center.
- The work is a collaboration with multiple researchers.
- PYOM is introduced as a high-performance computing code necessary for the tutorial.
- Viewers are encouraged to check previous videos and the PYOM wiki for foundational knowledge.
Overview of Steps for Shredded Scale
What are the steps involved in achieving shredded scale?
The process involves four main steps, which can be executed in separate scripts or through a Jupyter notebook.
- The first step involves parallel POD and sensor interpolation.
- The tutorial will guide through a notebook that covers these steps.
- Data loading and structure are crucial for the process.
- The steps can be executed with varying numbers of cores.
Performing POD on Training Data
How is the POD performed on training data?
The POD is performed by masking the field to select training snapshots and then executing the POD process.
- Randomized POD is used to recover modes from the dataset.
- POD modes and singular values are saved for later reconstruction.
- Validation and test data are projected onto the training POD modes without recomputing POD.
- The alignment of training, validation, and test snapshots is demonstrated.
Fitting and Inference of Shred
What steps are involved in fitting and making inferences with Shred?
After fitting Shred, the inference involves rescaling the output to the original POD magnitude and saving the predicted coefficients.
- Only the POD coefficients are predicted, not the special modes or singular values.
- The reconstruction process involves loading data and performing matrix products.
- The accuracy of the reconstruction is evaluated using root mean square error.
- The final reconstructed field can be visualized using the PYOM dataset.
Transcript
0:00 Hello everyone, my name is Benedang. I come from the Barca supercomputing center and today I would like to explain in this shred video series how we can perform the shallow recurrent decoders at scale. So in other words, how can we fit shred to a data set that needs parallel computing. So this work of doing shuttered scale actually is joint work together with Stephano Aria Arnamiro I Rodriguez Nathan KZ and LMU and to do that we are going to need pyom so I don't know if you have seen the latest video that it's in this channel about pyom but pyom is the high performance computing register modeling code that we are developing at the barn supercomputing center together with univers politenica. If you have not seen that video, I just leave you the link to a video in the description of this one and also the link to the to the wiki of pylum which actually I recommend to go through before doing the tutorial that we are going to do in this video.
1:04 So if you have never used PYOM, you have never heard about it, visit our previous video, visit the wiki and just go to the examples and the guide that we have on our wiki section. So there are many steps that we need to do for shredded scale actually just four. the first one it's the one that involves using pylon for the first time that it's performing the parallel proper oral de composition and also extracting our sensor data in parallel. No, if our data is so huge that we cannot fit it on a single core. we need to perform the parallel proper oral de composition there and also it's nice if we can just do the interpolation of our sensors in pilot. So the next step once we have saved the sensor interpolation and the parallel pod we need to do a shred in serial to fit the pod coefficient. So it's the the reduced version of shred that has already been shown in this video series. And then we have a a third step that is the inference to get the pod coefficients once we have fitted the different shred models that we wanted. Finally we go need to go at scale again to the reconstruction of the data. but we can do that thanks to pylum because pylum saves the pod modes in an H5. and then we just get the inference POD coefficients from shred and we reconstructed in parallel and we can visualize it in any format supported by by by PYOM or any format that you might want to use at that point.
2:36 So the first the these two the first and the last one the ones that are highlighted here in red are the ones that need to be done in parallel and the ones where pylum is going to play a key role in this step. And then we also have the shred part that can be done in serial that are the blue the blue steps in the pylum github repo. Actually there's a an example section which I leave you the link here and you will see in the in that sections that there are these four steps in four different scripts so you can actually have the steps in different in separated scripts and you can launch all of them well each of them separately but now I'm going to go through one notebook that we have at the pylum wiki I give you the particular link to the notebook here also So and that notebook is basically this one the shredded scale.
3:37 You will see that we're going to cover the four different steps that I've been talking here. Of course in that notebook everything is done in serial because it's just a jupyter notebook. but as I mentioned you have the script separate in the pylum repo and there step one step four can be launched with as many cores as you need to. So let's go through the first step the parallel POD and sensor interpolation. So we need to load the data. we can do that following the data structure from pylum. If we are working with some data that has a a mesh connectivity especially if that's an unstructured mesh we can load the mesh from pylum also. and we can load the data set from pyom. The data set from bom is a class that basically helps us to organize our snapshot matrices so that we have our data matrices all together with some metadata that we need like it could be the time at each snapshot was saved or the mage that it's linked to each of the data sets. you can feel free to load any other format that you would like but it's recommended for this tutorial that you use the pyon data set as there are some methods that are linked to this class.
4:53 So then we need to do the data splitting between training, validation and test. for this example we are working with the reconstruct mode. this is done through the pylon data set class. And basically we do it now because we need to split the different snapshots that we have before we perform the POD. After that we generate the sensors. So in this case we are going to generate sensors randomly. Okay. the sensors that we are going to generate are the we're going to have three sensors and we are just going to define some bones in our domain and we are going to let pylum generate these sensors randomly. And now we're going to generate a new data set for the sensors. and this new data set basically we're going to just input which variable do we want to have the number of sensors and the bounds for it.
5:49 And what pyom does in that case as we just want them to be random it selects the three random points in the mesh inside those modes and then we save that as an h5 file. all this operation is done in parallel. So actually each rank checks if they have part of the bounds in that in that region and if they should have or not one of the sensors. So once this is done in parallel then all the results are saved in a file that it's called that it's the sensors.h5 that can be loaded with any partition that we want. We don't need to open it with the same number of Franks that we have been running until now. Okay, this is quite of an important step if you want to perform then the street fit in serial as usual.
6:42 So next step is performing the POD of the training data. the this POD basically first of all we need to mask the the field that that we have. We need to select only the training snapshots. Then we perform the POD. In this case we are working with randomized POD because with the data set that we are working should be enough to recover just eight modes for that. and pod we save the pod modes with the pod safe function from pyome in this case know that we save special modes and singular values also apart from the temporal coefficients so that afterwards we can reconstruct the full flow field and then for the validation and test data we don't compute pod again we just project the the data that we have for validation and the snapshots we have for test to the special purity modes that we found for the training case. And here we can see an example of the first pod coefficient and how does the pod coefficient of training and the projection of the data to the pod modes of the validation and test look we can see that actually this is quite a simple case. We just have a single frequency in this first PD coefficient. But we see how the validation and test snapshots are aligned with the with the training ones. So next step is doing the fit and the inference of shred here in the notebook actually they are kind of coupled together because we are not saving any model and loading any model afterwards. But the original workflow that you can find in the pylum examples of shred basically they just allow you to save all the results after doing the feed and load all the results when before doing the inference. So the first part is loading the sensors. Of course we were working in parallel before we had to save our data from the parallel part and now we just need to load the the to load it in serial. So we load the sensors and we just get our training validation and test masks and we just separate the data that we had on the on the on the sensors between training validation and test. And once we have the input data loaded we need to load the output data in this case there are POD coefficients. So we load we load for the training data data first. note that when doing pylon pod.load we can actually choose which variables we can load. So in this case we're going to load the singular values and the pod coefficients. But we are not going to load the pod special modes because they are actually as big as the original data and we are going to crash the memory of our processor as now we are running in serial and we are not running in parallel anymore.
9:40 note that to select the variables you need to follow the pile of notation for the singular variables values and the period coefficients that it's the common notation of s and b. Okay. Now it's important to see that we also compute one factor that we called s scale that basically it's the percentage of the singular value that every mode has. We're going to use that as a scale to scale our loss function when training shred so that we make sure that the first POD modes that are the ones with a larger singular value, the ones that are more relevant to the flow field are actually learn better than shred than the ones with a lower rank. So next step is doing a scalar of the POD data. We just apply a minmax scaler and we save the scaler so that we can recover it afterwards when we want to do the the evaluation of the results so that we can have the same scalar and we do the scalar for the training data and then we just transform the validation and test per coefficients through the same scalar.
10:51 the next step is generating the different SH configurations that we want just in case we want to do some well some averaging of different shred methods so that we can have some uncertainty quantification of our shred results. Although in this case we just generated three sensors and we are just going to work with a single configuration. But just for you to know that you can just generate an array of sensors and then just do a for loop of training shred in that sensor. You can have an example on how to do that in the pylum example folder. Okay, in the in the let's say the full script, you can see how to do that using pylum.
11:28 here in the notebook and in the video, we're just going to go with a single configuration to to keep it as simple as possible. But in the case we had more than one sensor, we just needed to filter a bit. We just need to just select the training validation and test sensor data for the sensors of our current configuration and fit one scalar per configuration. Okay. we feed the scalar with the training data and we save it. and then we just transform the training validation and test data of that scaler. after that it's a matter of performing time delay embedding. This is common thread. You have seen it I think now many times in this video series in the channel and we do the training process of shred. We just build the data sets and we fit the shred. Okay.
12:18 after fitting the shred it's a matter of doing the the inference. We just do the input of the shred and we rescale it to the original pod magnitude because now we are we are working with a min max scaler. So now we go again to the our original values and then we save the the pod now the the predicted pod coefficients from shred. So we can use again the pylon pod. But we just say put non options in the special mode and singular values because we have not touched them.
12:54 We are not predicting them. We're just predicting the pod coefficients. And well here you could see how well shred actually is able to capture the first four beauty coefficients for that case. So last step of the video is how do we do the parallel reconstruction the par reconstruction you need to perform well to load the data okay first with pylum pod.load as we saw before and then perform the reconstruction with pylum.pod pod reconstruct that basically does the matrix products to reconstruct data from pod modes. So as here we were working with the fluctuations and we want to recover like the final flow field we just re them in again. Okay, this just something that we are just doing for this problem. and then we can compute the root mean square error between the pod and the original so that we see if we are doing it right.
13:57 And finally we can add our reconstructed field to our pylon data set and we can use the pylon data set to plot the snapshot. So we can take a look. This was the original data data set. This was the reconstructed snapshot. So actually it's right here. It's doing a good work. Actually this data set that I'm looking at it's a quite small it's a flow over a cylinder at reol 100. So it's pretty laminar. and also it's only 151 snapshots and has 90,000 points only. So it's something that can be done in serial but still we have parallelized it so that anyone can go to the link you have here to hugging face download the data set and just try that check that it works in parallel you learn how it works in parallel even using your laptop if you want and then you can go to bigger data the one that you have so that you can actually make it work with your data but you have this smaller test case that works both serial parallel using pylon and shred So that's the end of the video. thank you very much for watching it and well as said just check the links in in the video and now it's time for you to try shred at scale.
Summary
- Introduction to PYOM, a high-performance computing code for modeling.
- Overview of the four steps needed for performing SHRED at scale: parallel POD and sensor interpolation, serial SHRED fitting, inference for POD coefficients, and parallel data reconstruction.
- Importance of parallel processing for large datasets that cannot fit on a single core.
- Detailed explanation of data handling, including loading datasets, generating random sensors, and splitting data into training, validation, and test sets.
- Use of randomized POD to recover modes from training data, followed by projecting validation and test data onto these modes.
- Description of SHRED fitting and inference processes, including scaling of POD data and handling of multiple sensor configurations.
- Final step involves reconstructing data in parallel and visualizing results using the PYOM dataset.
- Encouragement for viewers to experiment with the provided smaller test case before applying the methods to larger datasets.
Questions Answered
What is the focus of the video series?
The video series aims to explain how to perform shallow recurrent decoders at scale using parallel computing techniques.
What are the steps involved in achieving shredded scale?
The process involves four main steps, which can be executed in separate scripts or through a Jupyter notebook.
How is the POD performed on training data?
The POD is performed by masking the field to select training snapshots and then executing the POD process.
What steps are involved in fitting and making inferences with Shred?
After fitting Shred, the inference involves rescaling the output to the original POD magnitude and saving the predicted coefficients.