In this presentation, we will calculate the cost per equivalent unit using the weighted average method in a prior presentation. We used this example data for our problem to compute the equivalent units of productions. We had the equivalent units of production calculated last time. We have the units completed and transferred out of the department in June. The work in process at the end of the month and then equivalent units of production in the department during June. That with regard to materials and conversion. These are the units that we're considering now. Now we want to think about the dollar amounts. We need to think about the dollar amounts. These are going to be given within the problem as well. Notice we would know the dollar amounts. What we need to know is how to allocate those dollar amounts between the amounts that are still in the work in process and the amounts that have been transferred out of the department. That's what we're trying to consider. In order to do that, we're going to use the units. We're going to consider the units here that we've now broken out to the units completed and transferred and the work in process that's still in at the end of the time period. We're then going to use an estimate to get the cost per equivalent unit so that we can then apply out the costs to the amount that's still in work in process and the amount that has been transferred out. Now we've got to consider the dollar amounts. We're going to use dollar signs within Excel as we consider the dollar amounts. We're going to start with the work in process in June 1st. We'll start with the materials over here. We're going to pull this amount from the table. This is given from the table. This is known from the prior time period. The prior time period we have the 6, 7, 3, 1 for materials. Then we have the conversion. The conversion we're going to pull from the table from the prior time period, the 4, 3, 1, 2. That's the 4, 3, 1, 2. If I add these two up, it adds up to 11,043. We'll use the sum function to do that. I'm just going to sum these up. The total then, the work in process at the beginning of the month, the amount that you could consider or think about in a T account or the GL account or the TRI bounce, 1143. Then costs that were added during the time period, cost added, we're going to say these are going to increase. We're just going to pull these from the table again. We are because they're the actual costs. We don't know where to apply them to. That's what we're trying to do. The costs that are added are the 130, 483 for the cost added in materials and the cost added related to conversion then is going to be that 89, 243. Remember, we know what materials are. Conversion is the labor and the overhead. That's going to give us the total. We're going to say that's the total costs. We'll just sum that up. I'm going to add up first the costs added, which is going to be these two items, 219, 726. We'll use the equals SUM sum of those items. Then we'll add them up vertically. We've got the 230, 769. I'm going to sum these up. Then I could copy that across or just sum up across. We're just summing all this up. Here's the total costs, materials, conversion and the total. These two, of course, 237, 69 adds up to that 237, 69. Now we want to consider the equivalent units. Equivalent units. The equivalent units, remember, we calculated up top. We have the equivalent units that we calculated here, the total units. We broke them out, but now we're going to consider the total so that we can then use this number, the cost per equivalent unit, to break out for these totals, which we'll do next time. We're going to say the equivalent units, not for the total, is going to be this number for the materials and this number for the conversion. That's what we calculated last time. This wasn't given in the problem, but we calculated it in the last presentation. That's going to give us our cost per equivalent unit. This is going to be a division problem. We're going to say here's the dollar amount 137214 for materials divided by the 6534, that's 21, and then the 93555 divided by the 6237 is the 15. We'll divide those out. This equals this number divided by this number. The dollar amount divided by the units gives us the dollar amount per unit. Notice this is all dollars. This is the units, dollar amount per unit. Then we're going to say this is the 93555 divided by the 623715. Notice we're in Excel and these happen to be perfectly rounded. We don't need pennies in this example by design, but obviously it wouldn't always be perfectly rounded and you'll have to deal with rounding. Just be careful if you're dealing with a problem that deals with rounding. Now we've got the cost per equivalent unit and we can use this number now to apply out to the areas that we're concerned with because we know we want to break out between the units completed and transferred out of the department. The amount is not in our department anymore. In terms of dollars, we're going to use the units times the dollars to get that and the amount that's still there at the end of the time period. That's what we'll do next time when we assign the costs to units to then assign out the costs that are still in our department, the costs that should be transferred out to the next department.


Hi everyone once again welcome to the LPS course this lecture we are continuing to look at the the Python programs we covered six of them today we are going to cover the remaining one so I am going to go quickly over these things basically so that you get an idea of how the Python code is written and what are the benefits of the once again Python is used for pretty much like I mean it is a scripting but at the same time you get the full power of the programming language so so here we are actually like going to the number seven which is the programs on lists essentially so here the first one is just a simple function given a list of numbers we return a list there all the adjacent elements have been reduced to a single element I just sent equivalent elements so if it is 1 2 2 3 the program returns 1 2 3 as a list so here we define this function remove adjacent and then basically it is a list of numbers and in the result it is also a list so we define as an empty list initially and then we basically say like I mean you for each of these elements inside this num so num num now if length result equal to 0 or num is not equal to result minus 1 then we append result minus up and result we use this particular method that is happened with the number so here you can see basically like I mean so the length of result is 0 that means that it is a starting point this right now it is 0 and then if the number is not equal to the result minus result minus 1 that means that the last element then we append it otherwise we do not append we just continue on then until all these numbers are exhausted and then we return the result as the list so simple program just look at the way that it is written how elegant it is all we do is essentially like I mean to smoke out the append that is what we are using it here so another one is basically given two lists sorted in increasing order create and return a merged list of all elements in sorted order you may modify the past in list ideally the solution should work in linear time so what that means is basically for every element it needs to take a fixed amount of time so that it is not an exponential or anything like that so we make we need to do only one pass for both the lists so here we define the same function like a linear mode this one on this two those are the two input ones that we are giving here and then we define a new one called the result a list and that is defined as an empty list front so then now we are going to do basically for while for we look at the two lists so long as both are non empty take whichever element is the smaller so that that is the whole overall algorithm there is in this comments I can see that so while these two lists are non not zero non zero now what we do is basically like this one zero is less than list to zero then we append as list one basically and then what we do is basically like I mean that that is actually removed from the list whichever one gets appended that gets removed from the list and if it is the other one then we append the second one and then remove that from the list now we track what is left by using result dot extend list one and same list two and then we basically return the list for the result itself again it is a fairly simple program to write just keep in mind about this here what we do is basically like whichever one is model we put it in the you know result list and then pop it out of the original list so now a test function used in main to print what each function returns versus what it is supposed to return this is our standard one that you know basically so if body is equal to expected then physics is okay otherwise physics is x and then we print the whole thing so now we test all these programs and basically so the remove adjacent we just give like 1 2 2 3 and then we expect the result to be 1 2 3 and then we also try it with some other things basically 2 2 3 3 3 should be just 2 3 and then if it is an empty list it should print an empty list and then for the linear merge we again do like a couple of conditions one is we do a a xx and bb cc and then the bb cc should be in all of that and then the if it is a xx and then bb cc then the bb and cc should be middle and then b should be at the end and then a a and then a b b b b b should be like three a's and then two so here is what we get when we run this programs and we can say that actually it has executed successfully so this is one way to actually test these kind of programs I think you should be aware of this and you should be using these kind of testing before you start beating the upper programs in an assignment now let us look at some of the programs or string again we will go through the similar kind of testing procedure so let us see what kind of things that we can do so the number one is at donuts this is given an integer count of a number of donuts return a string in the form of number of donuts the count the count is a number passing however if the number if the count is 10 or more then the use the word mini instead of the actual count so if donuts 5 returns number of donuts is 5 but if donors try 3 returns number of almost me so how do we do that so here we again define the function called donuts and then we pass the counts as input and if the count is less than 10 then we return the number of donuts is plus so number of donuts column and then we print this string count which is essentially like whatever the number that is less than 10 else we just return number of donuts and so basically like this is a very short program to test the I mean to do what we are wanted now the next one is basically both ends in some other function here essentially like I mean if length of this string is less than 2 then return nothing the first two is basically like it strings the two values and then the last two is actually strings minus two column basically that specifies the last two and then we return the first two in the law so this is basically the it returns the two characters at both ends of the string now a fit starts essentially this is given a string s return a string there all occurrences of the first character having changed to star except do not change the first character it is so if it is a babble that will become be a star star any so the solution is here this is we get the string s and then we define what is the front which is 0 and what is the back which is s minus 1 and then we say like I mean fixed back which is we use this method back dot replays essentially and that we with so this this gives you the rest of the characters essentially one column rest is basically all the ones that have after the first one the first one we already captured in the form and then so once you want to fix that this back basically we replace the front which is this character with the start so that replaces all the remaining occurrences of this front character with the start and then we just return front and the fixed back I think these are fairly easy I think you should be able to understand most of the stuff still go through some of these things so here the mixed up basically given strings a and b return a single string with a and b separated by space that is a b except the swap the first two characters of each of string so mix part will become box mid or dog dinner will become dig down so you define again the function looks up a b and then essentially like we define the a swapped is b the first two column plus a to onwards the remaining and then the swap is same thing basically is first two characters and then the remaining of the b and then we simply basically return the a swapped then a space and then be swapped so again same function that we define basically and then here this is for testing these above functions and then we just find the main as basically like what is the function part with what should be the the the return value and when we test these different functions essentially like all the four functions you get following output which is confirmed that they have written the code correct so now more programs on string here basically it is called the verbi because given a string its length is at least three add ing to the end unless it already ends in the ng in which case add ly instead if the string length is less than three and return the resulting string so here is the our little function which takes yes as the input string now we first of all we see whether the length is less than or equal to three if that is there sorry if it is greater than or equal to three so if it is there then we try to see whether the last three characters are ing this is s-3 and if it is not ing then we add the ing to to the end but if it is ing it goes into the else now we add ly as a string and append that to the original string and then we return this so in this case if it is less than three it basically leaves it as is now the next function is not bad which is given a string find the first appearance of the substring not and bad if bad follows the not then replace the whole not not bad substring with good return the resulting string so if it is basically like says like dinner is not that bad then you get dinner is good so it is a not that and that or anything that is between and that is basically replace it is good so the way that we write it is basically then we get the string then we find not so this is a method and we also find bad store it in these two variables and then if if they are not the last characters last one is essentially which is in not equal to one or B not in one and if B is greater than N then we look at the string and then essentially replace from the last the end character essentially so we take out the characters up to N and put the good there and then the remaining basically so and B plus 3 so so that means that essentially you continue after the back so we go up to not print good and then go after the back so this brings the whole new string so most of these kind of algorithms are still explaining to I will go through it but I think like I mean once you read it it will be fairly easy for you to understand how these algorithms are written and then as you can see like I mean these are less than 10 lines of code so you should be able to pick it up very easily okay so the next one is the front back basically which is the dividing a string into two halves the length is even then the front and the back half as the former the length is odd then we will say that an extra character goes in the front half that is ABCDE the front half is ABC and the back half is the given two strings A and B we return a string in the form of a front B front and then a back B back so we take these two strings basically and now we need to figure out the middle position of each string so a middle is linked a you are that you and B middle is linked B you are that you now we see whether it's an even or an odd if this is odd now add one to the length one is the length is odd and then so we add that basically a middle plus one if it is if the same thing goes for the below so you see basically like when we divide by two you don't put the decimal so that it is an integer division and it is a lower number so that's why we are just adding one to it if you use like dot 0 or something here then that will mess up the whole confusion so please don't do that and then finally we return basically the a string from 0 all the way to a middle and then B string with 0 all the way to be middle and then a string a middle always then and then be middle of it then again we do the testing program and then test it and here you see that basically so this is the example program on game this is probably the last one here first we say basically the high score for the game and now we do a try basically recommend the high score or text essentially and then so basically there is already exceptions built in into this one that's like that so we try to read the high score from this file that's the whole intent so whether we just read that high score and then we close the file and then we print the high score is so basically and then we generate any exceptions and then we try to get the score from the current game which is current score is 0 and then we ask the user for first score and then again we have an exception if it is type something else and then if current score is greater than the high score then we say like yeah you are in the score and then we also open the thing and then write out the new score into the file and then if it is not there then just say like print the like next time so here this is one thing that how the program does so that's pretty much all that I want to cover for today I hope like Python programming is quite interval with these kind of snippets you can actually build bigger programs very easily and I would like you to try those kind of things and these are all like some basic programs which from which you can build bigger and better programs thank you very much


Welcome to part 2 of the lecture on automatic parallelization. So, in this lecture we will continue our discussion on data dependences, direction vectors and look at a couple of examples of vectorization, concurrentization etcetera. So, to do a bit of recap we know that there are three types of dependences S 1 and S 2 are two statements and if the definition of X is used here without any modification it is a flow dependence. If the usage happens before the definition then it is anti dependence and if there are two definitions then it is output dependence. The data dependence direction vector is actually an additional information attached to the dependence itself. So, there is one direction vector component for each loop in a nest of loops. So, if there is a three nested loop then we have one for each of these three. The dependence data dependence direction vector is a d you know long vector where d is the depth of nesting and each of these components can be less than equal to or greater than then the others less than or equal to greater than or equal to not equal to and star are actually derived from the principal components less than equal to and greater than. The less than direction means it is a forward direction implying some quantity is computed in the iteration i and used in a later iteration i plus k. Whereas, this is the this is a very common type of direction vector component. Backward or greater than direction means that the dependence is from i to i minus k. In other words computed in the iteration i and used in iteration i minus k if this does not look possible. Of course, in single loops it is not at all possible, but in doubly nested loops or higher level loop nesting it is possible I am going to give you examples of this later. The equal to direction vector says the dependence is in the same iteration. So, computed in iteration i and used in iteration i. So, we saw this example last time. So, this is you know x j equal to x j plus c. So, the value of j is the same in the same iteration. We actually use it first and then define it. So, it is a delta with equal to whereas, this is x j plus 1 equal to x j. So, we compute first and then use it later in a different iteration. So, this is s delta less than s this is x j equal to x j plus 1 plus c. So, we use first and then compute. So, this is an anti dependence with less than direction vector and this loop is running downwards x j equal to x j plus 1 plus c. So, you can see that x 99 is used here x 98 will be used later and so on. So, this is still a delta less than type of relation and the last one is x j equal to x j minus 1 plus c. So, again we use you know we compute first and use later. So, this is again a delta less than relation. This is a different example with two levels of nesting. So, i and j are the two loops. So, we have a i j equal to b i j plus c i j and we also have s 2 which is b of i comma j plus 1 equal to a of i comma j and b of i comma j. So, this is the expanded version of the two loops. So, for i equal to 1 let us say we have j equal to 1 then you know expanding s 1 we get a 11 equal to b 11 plus c 1 and expanding s 2 we get b 12 equal to a 11 plus b 11. So, there is a flow dependence from this to this and obviously, the iteration is the same i iteration is the same and the j iteration is also the same. So, s 1 delta s 2 with both the directions be equal to. So, that is because of this. Then if you consider j equal to 1 and j equal to 2 b 12 is defined here in j equal to 1 and used in j equal to 2, but the value of i is the same. So, this is again a flow different you know flow dependence and computed in an earlier iteration and used in a later iteration. So, the first i loop has equal to direction vector and the second loop has less than direction vector and it is a flow dependence you know from s 2 to s 1. Then we have b 13 here this is s 2 again and it is used in you know j equal to 3 b 13 here. So, you can look at b 12 here and b 12 here as well. So, this is again a flow dependence and similar in type, but only thing is this is between s 2 and s 2 defined in an earlier j value of s 2 and used in a later j value of s 2. So, this is from s 2 to s 2 dependence is delta and the first component is equal to and the second component is less than. So, this is the direction vector in this example and the dependence diagram is also here. So, we actually place the same dependence as here from s 1 to s 2 there is delta equal to equal to. So, that is 1 and then there is 1 from s 2 to s 2 that is nothing, but equal to and less than with delta and the third one is from s 2 to s 1 which is equal to and less than. So, these are the three dependences that we have along with their direction vectors. So, this is a third example of a direction vector again we have two loops here in both these examples and this is supposed to show the direction vector less than and greater than. As I said greater than direction vector says computed you know in a later iteration, but used in an earlier iteration. So, it does not seem to make sense, but it does when we consider doubly nested loops. So, we have s 1 as a i plus 1 comma j equal to and s 2 as equal to a i comma j plus 1. Let us expand the loops with i equal to 1 and j equal to 2 we have s 1 as a 2 2. So, that is this part and if we take i equal to 2 and j equal to 1 then s 2 will be again equal to of a 2 2. So, that is i equal to 2 and j equal to 1. So, clearly there is a dependence from s 1 to s 2 a 2 2 is being computed here and a 2 2 is being used here. So, this is a flow dependence. So, that is a delta all right s 1 to s 2 there is a delta what about the data dependence direction vector. So, the value of i from here to here has increased. So, we compute in a lower iteration number and use in a higher iteration number. So, the direction vector for i is less than and for j we compute in a higher iteration number j equal to 2 and use in a lower iteration number j equal to 1. So, the second component is greater than there is no trick here it is just that the value of i is different in these two. So, the j loop starts running afresh for every value of i. So, in the iterations of j corresponding to i equal to 1 we define a 2 2 at j equal to 2, but then once we go to the next of i j starts running again and that is why we have the value a 2 2 here. So, we are really using the you know value of a 2 2 in a lower iteration number, but definitely in a different iteration of i. So, there is you know this is quite realistic. Then the second example s 2 less than greater than delta less than greater than s 1 we have the i loop and the j loop here we have a i j plus 1 and on the right side s 2 we have a i plus 1 comma j. So, again we expand i equal to 1 j equal to 2. So, s 2 is a 2 2 equal to and i equal to 2 and j equal to 1 s 1 becomes equal to a 2 2. So, again there is a you know flow dependence from here to here this is i value increases. So, the dependence is direction vector is less than for i the j value reduces. So, it is a greater than for s 1 for you know second component. So, all types of dependences are possible and I have given you examples of this. So, let us look at one more example. So, here we have 2 nested loop for i and j and then inside j we have 2 independent loops one for k and another for l. So, the only dependence from this to this is that x is defined here and x is used here, but apart from that because of i and j you know the there are other dependences as well. So, let us expand the loop with i equal to 1 a equal to 2 then 3 values of j j equal to 1 2 and 3. So, with i equal to 1 and j equal to 1 we have x 1 2 and sorry i equal to 1 and j equal to 1 we have x i j plus 1 and k I have not expanded k because k is an independent loop here and you know l is another independent loop here. So, we are only looking at the you know dependences corresponding to direction vectors for i and j plus 1. So, a suitable value of k here can always be placed you know k and l I can just place 1 here and 1 here there is no problem. So, x 1 2 k is defined here and then in the same value of i and with a different value of j x 1 2 l. So, I can place this make this 1 here and 1 here. So, that establishes a concrete dependence between the 2. So, that is shown here similarly between x 1 3 k here and x 1 3 l here there is a dependence I can place k equal to a suitable value and l equal to suitable value here right to make them the same. Now, for the second statement we have to a 2 1 l here which is used in a different value of i. So, a 2 1 k. So, k and l can be equalized again the a 2 2 l is defined here and a 2 2 k is used here. So, this is another you know instance of the same dependence. So, in the first case it was a flow dependence. So, there is delta and in the second case also it is a flow dependence. So, it is again delta. In the first case the first direction vector component is marked as equal to because it is the same value of i for both these. So, this is the same column whereas, here we have marked the first component as less than because there is a difference in the value of i from here to here this is equal to 1 and this is equal to 2. So, and this has increased in this direction the second component is less than here because j has increased in this direction. So, we have less than here and the value of j is the same across these two. So, we have equal to as the direction vector component here. So, if we draw the dependence diagram here. So, s 1 to s 2 we have delta you know equal to and less than. So, that is this and from s 2 to s 1 we have the other one delta of less than and equal to. So, you observe that this is from s 2 to s 1 whereas, this is from s 1 to s 2. So, these are the two you know adjusts in this you know dependence diagram. So, we will see how this matters a little later. So, far we saw examples of data dependence relations and direction vectors. Now, it is time to understand how to use the dependences in order to do vectorization and you know concurrentization. So, individual nodes are statements of the program and adjusts depict data dependence among the statements. So, we have already seen this this is how the data dependence diagram is created graph is created. If the d d g is acyclic then vectorization of the program is possible and is straight forward. So, remember the most important condition for vectorization is that the data dependence diagram or the graph should be acyclic. The direction vector by itself does not pose a problem here, but it will definitely pose a problem for the concurrentization. So, vector code generation can be done using a very simple topological sort order on the data dependence graph. So, suppose the graph is acyclic then it is a bit more complicated. So, we find all the strongly connected components of the data dependence graph and reduce the d d g to an acyclic graph by treating each strongly connected component as a single node. So, now the you know once it has become acyclic we can actually now generate vector code, but as far as the SC cells are concerned they cannot be fully vectorized, but the final code will contain some sequential loops and possibly some vector code. So, that is how this is going to be this is a bit more complex and it is not possible to provide a very simple example here. So, we are going to emit you know rather not to get any example in this case, but we will concentrate our attention here. Then so in the case of concurrentization if all the dependence relations in a loop nest have a direction vector of equal to then the iterations of the loop can be executed in parallel with no synchronization between iterations. So, remember direction vector value of equal to for a loop. So, in that particular loop if the direction vector value is equal to that means all the dependences are in the same iteration they do not flow across iterations. Therefore, iterations of the loop can be executed in parallel there are a couple of observations here which are very important any dependence with a forward direction in an outer loop will be satisfied by the serial execution of the outer loop. So, if there is a less than direction in the outer loop you run it sequentially then the dependence is automatically satisfied for that loop. And if an outer loop is in L is run in sequential mode then the all the dependences with a forward direction at the outer loop of L will be automatically satisfied even those of the inner loop. So, if we this is a very important thing if we are able to if we run the outer loop in a sequential mode then you know we can run all the inner loops in a parallel mode provided you know the direction vectors permit. So, we do not have to worry too much once we run it in sequential mode the everything will be satisfied in at the inner levels. So, we can run them in parallel only thing is the outer must have less than direction you know in all the edges. So, if some of the edges of the data dependence diagram corresponding to the outer loop have equal to direction vector then you know running the outer loop in sequential mode will not satisfy all the dependences. So, that will be a problem. However, this is not true for those dependences with equal to direction at the outer level. So, I already mentioned this the dependences of the inner loops will have to be satisfied by appropriate statement ordering or and or loop execution order. We are going to see examples of this very soon. So, let us take an example of vectorization. So, here is the here is a loop i with two statements s 1 and s 2 and here is another loop with i as the index with s 3 and s 4. The index of course, does not matter because these two are independent loops. Now, we have s 1 s 2 s 3 and s 4 the dependences among these statements is also shown here between s 1 and s 2 there is nothing in common. So, they do not have a dependence right and then x i is computed in this loop and then it is used in this loop. So, obviously, between s 1 and s 3 there is a flow dependence delta I have not bothered to indicate the direction vector. So, this is just dependence because vectorization does not bother about the direction vector. Then we have used x i here, but we have also computed x i plus 1 here. So, we compute and then use. So, this is the way it is. So, x 2 and then x 1 x 3 and x 2 etcetera. So, what happens is from s 4 we would have a dependence delta to s 3. So, that is also there right. So, this is very important and then again we have value of b i being computed here and the value of b i being used here. So, it is the same value of i. So, from s 2 to s 4 we again have a delta dependence and between these two s 1 and s 4 there is also an output dependence from s 1 to s 4 that is delta O. So, these are the various dependences in our program. Now, obviously, this is a directed acyclic graph. There are no cycles here. So, if we do a topological sort of this graph then the statements can be vector statements can be emitted. So, now this x i s 1 has no incoming arcs. So, we can emit the code for s 1 directly. So, x 1 to 99 equal to the vector constant 1 to 99. So, x i equal to i means x 1 equal to 1 x 2 equal to 2 etcetera. So, this is a vector constant 1 2 3 4 etcetera up to 99. So, this assignment is a vector statement for this loop this part of the loop. The second statement is s 2. So, again it is very similar b i equal to 100 minus i becomes 99 colon 1 colon minus 1. So, we have you know i equal to 1. So, this starts with 99 then goes to 98, 97 etcetera. So, this vector with a stride of minus 1 automatically indicates that it is a vector with 99, 98, 97 etcetera etcetera. So, this is s 2. So, these two do not have any incoming edges. So, this can be processed right in the beginning.  So, s 3 can be processed only after s 1 and s 4 are complete, but s 4 itself can be processed once s 2 and s 1 are complete. So, we have finished code generation for these two. So, in the execution order the vector code will be executed in the sequential order. So, this is s 4 and x i plus 1 equal to g of b i. So, x 2 to 100 equal to g of b 1 to 99. So, this is the vector statement corresponding to this loop this part of the loop and lastly the s 3. So, that would be a 1 to 99 equal to f of x colon 1 to 99. So, this is a very simple vectorizable set of loops. So, we just emit the code in the topological sort order and automatically it gets done. The second example. So, we have already seen this program before and we also discussed these dependences. So, from s 1 to s 2 there is a dependence delta equal to and less than and from s 2 to s 1 there is another dependence with delta less than or equal to. So, this is a cyclic graph and therefore, the loops cannot be vectorized. So, i and j loops cannot be vectorized of course, it is always possible to vectorize the k and l loops separately that is never an issue. So, now we actually try to run the i loop let us say in sequential mode. So, i equal to 1 to 100. So, we run the loop in sequential mode. Now, the dependences corresponding to i will all be satisfied. We can take out the i part from this dependence diagram. So, here for example, this less than this is equal to and less than. So, the equal to part can be taken out and in this case this less than is automatically satisfied and equal to is never a threat for vectorization. So, we can remove this arc completely. So, that is what we have done here. So, between this and this. So, you know so, this the equal to arose because of the second component right, but when vectorization is performed we are going to actually you know actually read this entire vector and then make the assignment. So, here also we are going to read the entire vector and then make the assignment. So, because of that the vectorization of the j loop is also possible. So, the i loop dependences are satisfied the j loop dependences change as before. So, we first emit the vector code for s 1 and then emit the vector code for s 2. So, automatically this is these are the two vector statements inside the i loop. So, these are executed sequentially. So, x i comma 2 2 1 0 1 comma 1 2 100 equal to a i 1 2 100 and 1 2 100. So, let us go back to the dependence diagram here. So, we are running the i loop in sequential mode. So, these are all going to be run first and then these etcetera. And the j part is you know vectorized. So, that is precisely what we are doing. So, this dependence is from this s 1 to s 2 since all the vectors you know in the vector code all the s 1 statements are executed first and then the s 2 statements this particular dependence will always be taken care of. So, that is what we have shown here. So, the x statement is run s 1 is completed and only then s 2 begins. So, automatically the dependence will be taken care of for this iteration for this particular two variables x and x. So, there is also a statement here that the j loop cannot be parallelized. So, that is true. The reason being the direction vector component is less than here, but it is less equal to for the i loop in this particular edge. So, what we really you know mentioned in the observations is that if the corresponding loop or direction vector component is less than in all of the edges then you know sequentially running that particular loop will satisfy all the dependences in words, but in this case we have equal to here and less than here. So, even if we run the i loop in sequential mode the j loop cannot be run in parallel mode, but the k and l loops can always be parallelized. So, assuming that we run i and j in sequential mode then this particular part k loop can always be and the l loop these two can be vectorized and run even parallely if necessary, but that is not advisable we will see why later. So, here is the example of the code which is slightly changed. So, the previous one we had you know the dependence in a slightly different fashion. So, for example, the dependence ran from here to here and here to here whereas, here the dependences are slightly different. So, even the code is different.  So, it is not j anymore. So, what happens is the dependence is not from here to this, but it is from here to the next one. This dependence is as before. So, it is still delta equal to and less than, but this particular dependence is from i equal to 1 to i equal to 2. So, that is less than again and here we have j equal to 1 and it is j equal to 2. So, again this will also be less than. So, we have delta less than less than for s 2 to s 1 and we have delta equal to and less than for this particular edge. Now, the dependences have changed. Now, it is possible to interchange the i and j loops. So, there are test for conditions for loop interchange. In this case they are satisfied. So, it is possible to interchange the i and j loops. In other words, the j loop runs first and then the i loop runs. If that happens or obviously, the dependence direction vector components also get swapped. So, this becomes a delta less than equal to and this of course, remains as delta less than less than. Now, both the edges have delta less than for the outer loop. So, that this would be the j loop and this would be the i loop. Therefore, we have the j loop and the i loop. The dependences you know even though they remain the same, it is possible to now run the j loop in parallel mode. So, whereas the sorry the j loop can be run in sequential mode. So, if we do that then you know the dependences of all the nested loops inside will be satisfied. So, in other words if we run the outer loop which is j in sequential mode, then the i loop can be run in parallel mode. So, that is the advantage that we have. So, that is about you know that is one of the examples that we have for concurrentization. So, we run the outer loop in sequential mode, and then we can run the inner loop, i loop in parallel mode. This is always advantageous because the inner loop being bigger the amount of work for each thread will increase. Whereas, if we had actually run the outer loop in you know if we simply say that the inner loop has very little work, then making it into a thread is of not much use. Here are more examples of concurrentization. We have i equal to 2 to n here, and we have j equal to 2 to n here, and we have s 1 and s 2 here. So, in this case again when we expand a loop i equal to 1, i equal to 2, and we have j equal to 1, j equal to 2 and j equal to 2, 3. So, we have a 2 2, a 1 1 here, a 2 3, a 1 2 here, a 2 4, a 1 3 here, and on this side we have a 3 2, a 2 1, and a 3 3 and a 2 2. So, a 2 2 is being used here, and it is being defined here. So, there are many you know dependences here. So, for example, we have you know a 2 2 here. So, s 1 delta less than less than s 2. So, from s 1 to s 2 there is a delta and that is a flow dependence s 1 to s 2, and then it is less than less than. So, this is i equal to 1 and j equal to 1, and this is again i equal to 2 and j equal to 2. In both cases the i equal to 2 is more than i equal to 1 and j equal to 2 is more than j equal to 1. So, this dependence corresponds to that. Then we have another one s 1 delta bar equal to equal to s 2. So, that corresponds to this B i j. So, I have not shown it here, but that is easy to see this is B i j and this is B i j. So, there is a usage and then there is a definition. The third one is also an anti dependence s 2 delta bar equal to equal to s 2. So, there is B i j here and B i j here as well. So, this is the usage and then this is the definition. So, there is an anti dependence from s 2 to s 2 as well. So, these are the three dependences in this loop. Now, in this case for example, if we i loop can be. So, this is the true dependence the other two are anti dependences and that is not of much importance to us. So, if we run the outer loop in sequential mode. So, that is the i loop then the j loop can be run in parallel mode. So, that is an advantage here.  So, obviously this will be satisfied. In the second example of concurrency. So, we have i loop here and the j loop here. So, we have s 1 delta equal to less than s 2. So, again you know so, we have a 2 2 here and a 2 2 here. So, it is same value of i, but different value of j. So, that is why this is correct. Then we have s 1 delta bar equal to equal to s 2. So, that is this B i j B i j and then of course, s 2 delta bar equal to equal to s 2 is corresponding to these two these three. Now, the j loop cannot be run in parallel mode, but however, the i loop can be definitely run in parallel mode. So, even here you know we cannot run the i loop or the j loop in parallel mode. So, that is why we resort to this sort of a thing whereas, here we have equal to as the component for this, this and this all three. So, loop can be definitely run in parallel mode, but the j loop cannot be there, but that is perfectly because running the j loop in sequential mode gives us a lot of work for each iteration. So, whereas, here we had run i in sequential mode and then we were trying to run j in parallel mode. So, if we do that, then the amount of work for the j loop is a little less compared to this. As it is you know if the j loop is big enough, then it could be run in parallel mode with enough work, but otherwise if the j loop has little work, then it is not a good idea to run it in parallel mode. Now, let us look at a couple of transformations which can increase the parallelism. There are many of these for example, recurrence breaking or cycle breaking, there are ignorable cycles, then scalar expansion, scalar renaming, node splitting, threshold detection, index splitting, if conversion etcetera. So, we are going to look at only a few of these to understand what goes on, then we have loop interchanging loop fusion and loop fusion. Scalar expansion for example, we have a scalar in the loop t here and t here. If you look at the dependence diagram of this particular program, then we have you know S 1, S 2 and S 3 here. From S 1 to S 2, there is a delta bar. So, from S 1 to S 2, so that is this a i and then there is from S 1 to S 3, there is delta equal to, so that is between this t and this t and then between S 2 and S 3, there is again delta bar. So, S 2 and S 3, so that is this part right and then from S 3 to S 1, there is delta less than bar. So, that is from here to here, that is we are using it here and then you know defining it there and finally, there is a self loop delta less than o on S 1, so that corresponds to this t. So, we write into the same location again and again, so the iteration i equal to 1 must write into t and only then the iteration number 2 can write into t. So, this is an output dependence on t on for S 1 and since the statement is the same, we actually have a self loop and obviously, it is less than because the iteration numbers keep increasing. This is obviously, a cyclic loop right, this this and this there is a cycle. Suppose, we make t you know into a vector that is the scalar expansion, scalar is expanded into a vector. So, we have t x of i equal to a i, a i equal to b i and b i equal to t x of i. So, if we do that then obviously, the loop goes away right. So, this loop is gone and we have from S 1 to S 2 that is very you know that is this right and we also have from S 2 to S 3, so that is also there and we have from S 1 to S 3 this is S 1, this is S 3. So, this is a flow dependence, rest of the dependence is vanish. So, now this particular data depends diagram is cycle free. So, we can vectorize it using topological sort. So, we do this first then this and then this. So, we can very simply execute rather emit the parallel vector code for this. The other possibility is if we are running it on multicore processors, we can actually make this temp t into a private variable separate for each core. So, assume that each iteration runs on a different core. So, for each core we have a space little bit of memory space available. So, we make it a private variable for each iteration. So, then again this becomes a cycle free you know just like this there is no cycle here and all the dependences are within the same iteration. So, we can easily parallelize this particular loop as well. Scalar expansion may not be always profitable. So, if you consider this program we have t equal to t plus a i plus a i plus 2 and a i equal to t. So, this is a cyclic graph right there are many dependences. So, you know so we have a dependence from S 1 to S 1, we have a dependence from S 1 to S 2 then we have one from S 1 to S 2 for this and then we have again you know this a i plus 2 to a i right. So, there are many many and of course, one on S 1 to S 1 itself. So, there are so many of these dependences here and it is a cyclic d d g, but making the temporality into a vector actually still retains this as a cyclic data dependence graph. So, it does not change it at all you know from the couple of them removed. So, this is gone right, but this remains there is no change because of this. So, because of this there is this remains and then we also have a cycle from here to you know here to this and this again right. So, this is this to this there is no cycle, but we have a cycle right here this is still cyclic. So, we got rid of one of them this particular thing we got rid of right and we also got rid of this to this, but this cycle still remains. So, cyclic data dependence graph cannot be vectorized we will have to do this sequentially and then vectorize the rest of them otherwise we need to run it sequentially. So, scalar renaming tries to you know remove anti and output dependences.  So, if we introduce a separate variable for each of these. So, they become t 1 and t 2. So, the output dependence between s 1 and s 3 now goes away the now you know we can vectorize this code. So, there is no problem we removed the by renaming the scalar t and making it separate t 1 and t 2 we have eliminated the you know output dependence and now the vector this can be vectorized. So, that can that is easy to see because this t 1 does not have any dependence on it. So, now this is a i here and here is a i plus 2, but we are not actually executing this particular code in concurrent mode we execute s 3 then s 4 then s 1 and then s 2. So, automatically we compute here and then use it in s 1. So, compute in s 4 and then use it in s 1. So, that is automatically taken care of then we have compute in s 3 and use in s 4. So, compute in s 3 and use in s 4 that is also taken care of and then we have compute in s 1 and use in s 2. So, that is also taken care of right. So, in this manner we can parallel you know make this code run in vector fashion. So, we had looked at if conversion a little before now if conversion is also a way to assist in vectorization and of course, concurrentization. Here we have a program i equal to 1 to 100 if a i less than equal to 0 then continue a i equal to b i plus 3 otherwise. So, in this case if conversion says you know if this is a conditional statement. So, there is no way we can make it a vector code. So, what we do is we introduce a vector condition for a i less than equal to 0. So, b r of i equal to a i less than equal to 0. So, this is a vector of conditions and we make this you know change the program by is saying if not of b r i then a i equal to b i plus 3. So, instead of continue we made it like this and now assuming that there is a masking operation available in vector machines. The masking says wherever the mask is true execute the statement and wherever it is false do not execute it. So, we compute the mask as before then we have this is in vector mode. So, instead of this now this was still a sequential loop. So, now we made a vector of the conditions and then we said where not of b r 1 to n a 1 to n equal to b 1 to n plus 3. So, we have actually introduce this masking statement and this is still a vector code. So, this is the advantage you know if we use if conversion all the control dependence because of the if then else condition is automatically translated to converted to data dependence here. Then we have another example with s 1 s 2 s 3 s 4 inside a loop. So, we have an if then and then there are two you know there is a statement c i equal to c i plus a i and then we have another statement d of i plus 1 equal to d i plus 1 plus 1 and if. So, there are two statements here within the condition and there is one statement outside the condition. So, if you draw the dependence diagram now there is s 1 then s 2 they do not have any you know dependences on them now there is s 3. So, s 3 is actually dependent on s 2 in by a condition. So, that is why it is shown as a c and there is a dependence from s 1 to s 3 as well. So, that is because we are using a i here compute it here and use it here. Then we have you know a dependence from s 2 to s 4 which is again conditional just like s 2 to s 3 was a conditional dependence this is also a conditional dependent and then we have a dependence from s 4 to s 1. So, that is because we are computing d i here and using it here. So, these are the various dependences now you know we can actually emit vector code corresponding to this. So, what we do is we for i equal to 1 to n right. So, sorry this i loop actually this should be removed this is a minor mistake there is no loop here this is basically a vector code. So, temp 1 to n is equal to b 1 to n greater than 0. So, that is what we compute as the condition that is a vector and then we have a mass execution where temp 1 to n d 2 you know colon n plus 1 equal to d 2 colon n plus 1. So, we execute the second statement as a mass statement. So, what we have really done is we have executed the mask statement first. So, that is s 2 and then we have executed the s 4 statement because s 1 is dependent on it. So, that is a conditional mask statement then we execute s 1. So, which is an unconditional statement and then we execute s 3 which is again a conditional statement. So, this statement is again conditional. So, the order in which this is being executed is the topological sort. So, first s 3 then s 4 then s 1 and finally, s 3. So, this is the execution order and this is the execution order for the vector code. So, just omit this i equal to 1 because there is no loop there. Loop interchange is another very important transformation. So, for machines with vector instructions inner loops are preferable for vectorization and we can use a loop interchange to enable this. For multicore and multic processor machines parallel loops are preferred to be you know parallel outer loops are preferred. So, again loop interchange may be able to achieve this. There are very simple conditions for loop interchange to be possible. Of course, l 1 and s 2 must be tightly nested no statements between the loops and then the loop limits of s 2 must be invariant in l 1. So, we cannot have i equal to 1 to n and the second one saying j equal to i and then something else i 2 something that cannot be done. Then most important is there are no statements s v and w in l 1 with a dependence of s v delta star less than greater than s w. Delta source stress it could be any of the dependence less than I know either true anti or output. So, if we have s v delta star s w with less than and greater than then if we interchange the loops this greater than would become the first component which is meaningless that is the reason why such loops cannot be interchanged. So, this is very simple these two loops and this statement the dependence is s delta equal to less than equal s. So, interchanging is possible the i loop cannot be vectorized. So, now you know we interchange the two loops j runs outside and i runs inside. Now, the inner loop is definitely as you know vectorizable sorry here j loop could not be vectorized and i became the inner loop. So, now we can vectorize the inner loop. So, the dependences have also become dependence direction vectors have changed you can observe that here. So, this is the vector code that corresponds to this particular thing. So, we run the outer loop in sequential mode and now the inner loop runs in vector mode. Again here the outer loop is not parallelizable because we have a less than. So, we want to exchange these two once we exchange it becomes equal to and now there is more work per thread because i loop will be now be run in sequential mode and the j loop will be run in parallel mode. So, this is how each thread will now run a loop. So, that is how it runs. So, if you look at the diagrams for dependences let us say this is the these are the various instances of statements for i equal to j equal to different values. So, and let us say these are the dependences in black. So, if we were running the loop in this fashion to begin with now loop interchange will run them in this order. So, you can see that with this type of a dependence there is no violation of any of these dependences that is what is most important if the loop interchange has to be legal. Whereas, if we have something like this then you know running it in this fashion will satisfy the dependence of this kind from s 1 2 to s 2 1, but if we run it in this fashion this runs before this. So, the difference is violated. So, any of these backward dependences are going to be violated if there is a loop interchange with loops of this kind. In some cases we have dependences in both directions right rectangular. Now, loop interchange is legal, but obviously it does not give you any benefit because we cannot you know run any loop in parallel when there are dependences in both directions. So, that is the example for loop interchange being possible, but with no benefit. Now, loop fission is something which says the whole loop may not be vectorized a vectorizable. So, divide the loop into smaller loops now this loop is vectorizable, but this is not, but still the program speeds up a little bit because this loop becomes vectorizable this is loop fission. So, we divide the loop into two parts. So, in this case for example, there is a dependence from s 3 to s 2 you can see that s 3 to s 2. So, we have c i here and c i plus 1 here. So, we compute here and use here. So, if we break the loop here make these two into one loop and s 3 into another loop obviously, this dependence will be violated. We cannot really compute something in the s 3 and then use it in s 2 because they have become in separate loops whereas, in this case all the dependences are in the forward direction. So, we can break the loop either here or here or both places. So, in other words we can make three loops out of these three statements and still there is going to be no violation of any of these conditions. So, that brings us to the end of the lecture and the end of the course as well. Thank you.


Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I am going to demonstrate how you can update fields. So we are going to update parent field and all related child fields will be updated automatically. So the use case is when an account record is created or updated and its description is not null. So I am talking about description field if it is not null and it is updated, then populate description of account record on all child opportunities. So before starting, if you want to follow Salesforce training videos, you can search for Sanjay Gupta on YouTube and you can follow my YouTube channel. So as per this use case, so if we see account record, so here we have description field. So whenever it is updated and it is not null, then we need to populate that on all child opportunities. So here you can see description field is available. So account description will be available on all child opportunities description field. So that I'm going to implement with the help of process using process builder. So process will be on account object, whether record is created or edited. Here I need to put the criteria. The criteria is check description. So account description is null false and account description is changed through. So it is changed and it should not be null. Then this process will be executed and immediate action. We need to choose update record. So update child opportunities. So here you need to choose selector record related to account. I'm typing opportunities. So here we also have two options update record that meet all condition or no criteria. So you can also add condition here to update. I'm choosing no criteria just update the field. So from here I am choosing description field of opportunity and with the help of field reference. I'm going to choose description field of account. So account description will be populated on opportunity descriptions. Now I'm clicking on save. So this way here you can see criteria is available. Description on account should not be null and it should be changed. Then description of opportunities will be equal to description of account. Right now I'm going to activate this process. So right now if I close this tab so I am on account record now. So this account is related with only one opportunity. So I'm opening this one in new tab. So this opportunity is related to the account which is in this tab. So let's see the opportunity description. It is blank right now. Let's see the account description. It is also blank. Now I'm going to update this one. So account description. So writing test account 2020 and I'm clicking on save. So I updated the account description. Now I'm going to refresh this related opportunity. Clicking on the details and I am scrolling it down. So here you can see on opportunity. This is populated automatically. Now I'm going to create one more opportunity for this account. This is created now. So here you can see two opportunities are available. So this test opportunity for ACC is open in this tab. Now I'm going to open this one in another tab. So it is opening clicking on details. Scrawled. I'm scrolling it down. So here you can see description is blank because account was updated earlier. When we created this opportunity. So now I'm going to update this account again. So I'm updating its description again. So I'm adding updated. So now this is the description if now I click on save. So both opportunities will be updated automatically. So I'm clicking on save. Refreshing this one and refreshing this one as well. So on both opportunity record, you will see the updated description. So I'm scrolling it down. So here you can see update is updated is added. And for this opportunity, if we see the details. So earlier it was not having anything in description. Now it is having this in description. So these two opportunities are related with this account record. But when I updated this account record, both the opportunities are updated automatically. So this way I updated all child records while updating the parent record. So this you can do with the help of processes and process builder. So whenever you want to update all child records on creation or updation of parent record, you can choose processes and process builder. So I hope you understood this properly. If you want to watch more Salesforce training videos, you can search my name Sanjay Gupta and you can follow my YouTube channel on my YouTube channel, various playlist related to different topics of Salesforce are available. So you can follow them. I hope you understood whatever I demonstrated in this video. Thank you for watching this video.


environment where there is no space for violent ideologies and which is an environment which is conducive for peace building and for coexistence and nonviolence. Well, Aware Girls is the only young women led organization in the northwest of Pakistan. In the Khabar Pukhtun Hooperans of Pakistan and we are also working in the federally administered tribal areas in the FATA areas of Pakistan which is a very unusual happening. Well, we are working to challenge the extremist narrative. We are dissuading young people to be recruited by the militant groups in a country which is ranked number four in the Global Terrorism Index Report 2016 and through the work of Aware Girls, we are breaking the cultural, the patriarchal and social norms and values every day. Coming from the northwest of Pakistan, I have lived the reality of violent extremism and conflict but I wanted to do something to change that. So in 2009, from platform of Aware Girls, I established a group called Youth Peace Network which aims to counter and prevent extremism which is a very unique network to build peace and harmony by engaging young people, including young women and girls as peace activists, by empowering them and by creating environment where they can engage in the civic and the political processes, by imparting them the skills of nonviolent conflict resolution, tolerance, pluralism, enabling them to promote alternative narratives of nonviolence. We are engaging both young women and girls and young men and we shape our approaches accordingly because we experience firsthand the differentiated impact conflict has on young women and men and also the research has shown that gender equal societies are more resilient to violence and conflict. Youth Peace Network, we are also using different strategies like peer-to-peer education in which young people reach out to other young people who are very much vulnerable to be recruited by the militant groups. But we are also using different strategies. We have created digital stories and they're available online on our channel. We have written blogs, media campaigns, peace campaigns in the community. They include sports events, study circles with other young people, workshops, walks, like different strategies to promote the values of peace and nonviolence. We are reconstructing the bonds in the community that has been destroyed by the militant groups and we are strengthening the social fabric of different, by actually bringing together people of different faiths, different cultures and different sects, by bringing them together through interfaith and intercultural dialogues through which they understand each other but also through different intercultural exchanges programs like visiting to a mosque or to Gurdwara which is sick place but also to Hindu temples and also to churches. We are through these strategies, we are connecting communities through music, through arts, through poetry, for peace because collectively all these narratives built the values of tolerance, pluralism but it also actually ultimately takes away the oxygen from the extremist groups and narratives. We have also reclaimed spaces from the militant groups in different parts of the country and different places which were first the headquarters of the Taliban, you need the Taliban regime but we have converted them into peace institutes. A young girl from Youth Peace Network shared that we the young girls have to stand up, join hands and assert ourselves more meaningfully by ending conflicts and bringing sustaining peace. Well, in 2009 Youth Peace Network started only with 30 young people but now in 2017 we have more than 20 active groups not only in Pakistan but also in Afghanistan. They are reaching out to more than 3,000 young people annually because we believe that the millions of young people out there who are not buying the militant agenda are a huge resource for us and we have to invest in them. In 2016 a young girl started another initiative and we set up a PAK Afghan Women Peace Network which is a network of women and girls peace builders from Pakistan and Afghanistan working towards countering and preventing violent radicalization. The network is bringing together women peace builders from both these countries to strategize together this year lessons learned towards lasting peace in the region. The young women and girls are for where girls are investing in the communities for countering and preventing violent extremism and we are also dealing the issue with a very holistic approach because we are aware that working for peace is not only about countering or preventing violent extremism but it is also about ensuring policies and also have these actual, the policies which ensure inclusion, which ensure pluralism, social cohesion, protection of the freedom of the citizens and women empowerment. So CVE or PDE is just a very small part of this bigger, of this bigger solution. And we are fighting the extremist groups and ideologies also by addressing the vacuums which provides even more fertile ground to the extremist groups and extremist narratives by empowering young women and girls in the political processes and strengthening the governance structures in the Northwest of Pakistan. As we know that the weak governance structures, they're also one of the factors that give more spaces to the militant groups and young women are deliberately excluded from political participation in Pakistan through formal written agreements between the extreme religious groups and the political parties and also women polling stations being attacked and torched. Therefore, we are using different strategies for effecting participation of young women and girls as young women and girls are the best people to know and resolve not only their solutions and their issues but also their communities, but also like in their communities as well. They do have the solutions. In some parts of the Kheber Pughtunhwa such as Mardan and Savabi, we have analyzed the reasons for low participation of women in the political processes through a survey. And actually that survey showed that more than 80% of women never participated in any political campaigns, any assemblies or they ever voted. And while we were working in those communities and those rural communities in 2015, 10 women won local elections after they participated in our training program. Well, these 10 women changed the history of those villages because for the first time ever in the history of those rural communities, women were running for elections and they were winning those elections. These young women when got trained, they have helped other young women getting their national identity cards, which is actually a requirement if someone wants to vote, but also encourage them to vote in the local and into the, into the national and local elections. And they have also informed other women in their communities about their basic human rights but also to exercise them. We have also strengthened the leadership skills of elected women counselors, enabling them to participate effectively in the local government structure and actually to effectively advocate for peace processes. We also brought together young women and elected young women on one platform that we call Women Democracy Network. We have established this first ever democracy network in the Kheber-Burhtengwal to share the experiences but also to strategize for effective participation of women and girls. Another strategy that we have used is to sensitize men on this issue and we have worked with more than 5,000 men in those local communities to change their attitudes towards women and girls participation. Because for women's participation one, it's very, to increase this change in the conservative male attitude is very important and it's very necessary because in many of these communities, what happens is that men are the one who prevent women and girls from joining any political party or even campaigning, voting and they also force them to vote for a specific political party. Well, I believe that when we invest in girls and young women and when we empower women and when we invest in political stability, we are taking away the oxygen from the violent extremist groups. We have also established more than seven participatory governance structures which are known as citizens committees in the northwest of Pakistan but also in the tribal areas which actually advocate for young women's political participation in the peace processes and they provide a bridge of accountability between the citizens and between the elected officials and they also provide a means whereby women hold their candidates accountable for the promises that were made in the previous elections but they also help them to articulate demands in the next any upcoming elections. And through these different diverse strategies, we are effectively working to strengthen young women and girls' participation in the peace processes and as we know that when women are also included in the peacekeeping processes, there is a 35% increase that the agreement will last for more than 15 years. We have also started a very unique initiative, another initiative that's where girls sit in open spaces and open air spaces but that's not a common sight in the northwest of Pakistan and that initiative is called Let's Talk Politics.  Actually, everyone belongs to politics. So strengthening these governance structures through effective participation is, I believe that it's a very vital step towards peaceful society. Let me also share that, yes, that these women and girls, they are unstoppable force for social change and development and sustainable peace. I believe in the power of girls to change their own lives and of their communities. Girls are champions of equality and their rights matter. Their dreams matter, their voices in the peace processes matter. There are no exceptions to that. Besides working at the grassroots level, what awareness has done at the global level, we have pushed the global boundaries and awareness is the only organization from Pakistan who advocated for the United Nations Security Council resolution two to five zero on youth peace and security which was unanimously passed in December on 9th of December, 2015. And we are advocating in the UN and also in Pakistan for active and meaningful participation of young women in the implementation of this resolution. While working with girls, what I have learned that incredible things happen when young girls speak. I have learned that voices are more powerful than weapons. If wars and conflicts have to be prevented, we need more voices and more voices of young women and girls who don't need weapons. I have actually a example of another hero from Aware Girls and Jen also mentioned about her. She is the Nobel Peace Prize Laureate, Malala Yusufzai. Before she was shot almost 60 years ago, she attended our training program and she is a true example of the change that Aware Girls want to bring in the society and in Pakistan. She spoke up, she refused to be silenced and she raised her voice against extremists. And that's, I think today is also when just five years ago she was shot because she was speaking for the girls' right to education and only two days back she attended her first lecture at Oxford. Speaking up for girls' rights and peace has been a very fascinating journey because one that I have met so many amazing women and there are so many amazing women and girls which I am because of the time constraints, I'm not able to share their amazing stories and their powerful testimonies, but for me as well it has been a very, as I said, a very journey that I have learned so much but it also a journey that I have to pay a cost for this journey as well in terms of life-threatening situations, in terms of my family being attacked, in terms of being not safe in my own country but also the attack which continued outside of Pakistan as well. But these attacks, these threats strengthened my commitments for peace. And I never stopped even a single time just because of these threats and attacks because I always kept in mind this one quote also from Bacha Khan who is also known as the frontier Gandhi and he led nonviolent movement when Pakistan was colonized at that time here, but his quote is that it isn't enough to talk about peace, one must believe in it and it also is not enough to believe in it, one must work at it. And that actually kept me going and going and to continue my work for peace in the world. Well, as I will leave you all with some final thoughts and as you know that bigger discoveries in the world have always started by asking very simple questions and I do have very simple questions from all of you and as you know that when Newton asked this very simple question that why Apple fell on the ground and why it's not going up, it led to the discovery of the law and gravity. So I do have these very simple questions and I encourage you as well to start asking very simple questions. Why in 2017 there are, we, when Jim talked about these all, so many millions of girls being just killed and being swept away. And also why there are millions of women and girls who are forced to displace because of violence and extremism because today while we are talking about, while we are talking, we know that there are millions of camps who are being even more filling with displaced women and girls. They are becoming home to many millions women and girls. And also why there are few young women and girls in the decision-making processes? Why we are still asking and why we have to, still in 2017, we have to ask for more participation of women in all these processes. Why it's not happening? I think these are very, very simple questions and I encourage you and I believe that these questions, the answers to these questions will lead us to much bigger discoveries than the gravitational forces as well. Thank you. Sabah, and I'd like to start where you ended. You talked about some important stories of engaging girls' voices in Pakistan and elsewhere. And as you say, yet there are very few girls' voices in decision-making processes. So how do we more actively engage girls' voices in the very programs and policies that affect them? Jin, let's start with you. Oh, I thought you were going to start. I'm following up from her. I see, how can we engage more? More actively at the local, national, international level, we need to engage girls' voices if we're looking at empowerment. How do we better do that? Well, at every level. At every level. Yes, you can find girls and bring them to your program. Have them be part of your advisory board. You know, Scott, I heard Christian Nagard talk about who is the chief of IMF and she said that she had a list. She had a list of women leaders that she could tell and give to CEOs when they said, you know, we just can't find credible women who could serve on the board. So she just had this list. Kind of like the binder that Mitt Romney carried. Names of women carry names of girls. They are everywhere. And if you need them, come find me. I can help you find girls anywhere in every country. Just carry them, put them as part of your program in developing your program from beginning to end. They need to be intimately participating in every stage of the program. Thank you, Saba. Yeah, so thank you so much, Jin, for saying that yes, there are women. They need to be shown and they need to be more meaningful participation of women and more active. And I think that in terms of that, that the way I see that they can be engaged also, the way the investment in peace-building processes is happening, I think that also needs to change to make sure that young women and girls are able to participate in that. And when we see investment in local peace-building initiatives and these commitments, we have to also reduce the militarized approaches for bringing peace. This will also change the way it is. And because in the name of counter-terrorism and militancy, the world has already spent a lot of money and financial resources on more guns and more weapons and more missiles. But the amount of money and the resources that is spent on each of these instruments, you know, of these militarized approaches, it is, I believe this is injustice to every woman and girl who wants to go to school. She's not able to go. It is injustice to every kid who is hungry but is not fed. But also it is injustice to every girl who wants to be the change, you know, who wants to be the leader of the society but she's portrayed as or she's seen as only the passive victim of this war and conflicts. And she's only seen to be as someone who is victimized and not someone who can actually participate in all these processes. And I will actually share some figures by Stella Elworthy who is the co-founder of Peace Direct and she has recently launched her book which is called Business Plan for Peace. And in that she has shared that the armed conflict are causes a lot of massive economic losses every year but when we see to the peace-building and to the peace-keeping, they are very grossly underfunded. And the spending in 2015 on peace-building and peace-keeping together represented just 2% of the economic losses which was caused by the conflict. But if you look at the cost of scaling up the most effective systems to prevent war over a period of only 10 years that would only cost under two billion. And to give you an example with the currently the world is spending $9 billion on ice creams. And I'm not against ice cream. I really like ice cream but what I would like to have is that every person in this world eat ice cream in a very peaceful society and enjoy ice cream. That's a great vision. Eating ice cream peacefully. So I have one more question and I'm gonna open it up to the audience for your questions. So please be thinking of them. So Gin, you mentioned the SDGs, the Sustainable Development Goals as we know the extraordinary 17 interconnected development goals by the year 2030. And of course, goal five is about achieving gender equality and women's empowerment. It's so much more than education. But we often think of empowerment as education which is step one. So could you talk a little bit about the other kinds of empowerment? You talked about the importance of self-awareness. Speak about the other kinds of empowerment that we need to be working on beyond education. Sure, I love talking about the SDG because usually it's not an audience like this. I speak at universities and many, especially in the United States, they have no idea what SDG is. You know, it's like LOL. They're trying to figure out, hmm, do we have an emoji for that? And they're trying to think about SDG. I say, what does that stand for? So the field that I've lived and worked my whole life is gender equality and women's empowerment. And I've learned that we're spending so much time counting, counting, piddly numbers of how many women in Parliament are in Congress. How many girls are going to school? And we really know nothing about what empowers women, what is women's empowerment. So I think in order to leapfrog, this is why it's a social revolution, to this cause is to really learn more until women and girls are empowered. We are not going to, the numbers are just increasing too slowly. So we really need to gather more data about what empowers women. Are women and girls empowered? And this is why I uniquely and strategically focus on this group, millennials. I mean, if they are the most studied and surveyed generation ever, we know everything about their behavior and because they usually live online, it's very easy to track. So I'm doing the exact same thing. Do they have control over their lives? And it is, if we can do that, and if marketers, technology, social media can do it, why aren't we peace builders doing that? Why aren't we tracking what they're doing? Do they have control over their lives? And so that's been my goal. Great, Zafa. Yeah, so answering to the SDGs, I think that one is achieving overall the gender equality is very important to achieve all the SDGs. And SDGs are very much interconnected to each other. And I think that the world should ever forget about achieving the SDGs and about the sustainable development agenda if women and girls who are like almost half of the population of the world, if they're not included in that processes. Sorry, I'm a little sensitive about the... A little bit. 50%. So they're little, they're even less. So even less, but if they are not, but my point is that the women and girls, if they're not included in these processes, no one is going to achieve. We are not going to achieve this agenda. And also, looking at when you mentioned at the point of education, I think one, and I mentioned in the very start of the story, is also that education is very important. But I think that we can start also from educating young women and young girls. Like in Pakistan, actually 47% of children between the age of five and 16, they're out of school, and out of them, girls are actually 53% of them are girls who are out of school. And the province I come from, from the north-west of Pakistan and the tribal areas, which are most hit by the conflict. And where women and children are making at least 70% of the displaced population, insufficient arrangements are made for girls to get any opportunity to even have the initial level of education, like basic education. And why? Because again, to the point of investments that some countries think that investments and weapons is more necessary than building schools or building roads to the schools or having more teachers in these schools. And also, Malala Yusuf's day once said that to end education crisis in the world and to ensure that all children get some quality education, the world need extra $39 billion and will spending on education. This figure may seem very huge to some of you, but let me just tell you again, it's not a very big amount because if we cut down the military spending by eight days, we're able to get every kid in the world to go to school and have a complete their basic education, especially young women and girls who are able to unleash their economic potential, who are in these panels, who are able to have this education to make better change, make their communities change and have healthy lives. Thank you. So I'm going to turn it to the audience. I realize there's a lot of expertise here. So if you actually have a suggestion or a specific program that's been affected briefly, we only have a few minutes for questions. So please raise your hand and Mike will come to you. Yes, sir. Just wait if you could bring the mic. My name is Tatsushi Arai. School for International Training, I have been a student of Afghanistan. Could you put the mic close to your mouth so we could hear you? Tatsushi Arai, School for International Training, I've been a student of Afghanistan, Pakistan for some time and I really admire both of the presentations, but my question goes to Sabah about how you encourage those girls or women who face tremendous persecutions and traumatized. Do you encourage them to stand up once again to face all the violence or how do you actually cope with the psychological effects because it's a tremendous struggle you're engaged in? Are we taking a few questions together and then answering? Is there another question now? Yes, ma'am. We'll take, we'll group a couple. Okay. Do you want to pass the mic down? Thank you to both of you. My question is about maybe some of the challenges that happen when girls do try to participate or are trying to go to school. For example, jeering of maybe some male classmates when they're speaking up in class and just as an anecdote or an example of this or perhaps harassment by male teachers, which happens or girls being forced out of school if they become pregnant and not being allowed back in. So just curious, like both of your work, if you're seeing things like that and how you're handling it, these are nuanced issues, but just some of those nuances, how you're trying to approach those and improve them. Thank you. Okay, okay, one more question right there. Hi, I thank you all for your amazing presentations. My name is Yvonne, I'm from Kenya and my question is directed to Jean. Okay, as a child and later I utilitated my country, I was interested in issues, peace, building and security because when I was in high school, I started working on the summit through modern United Nations, then later pursued it academically. And as a result of my passion, I got the opportunity to travel with my government once in a while as a young woman, which was very rare to meetings, for instance in EGAD to address issues of al-Shabaab, but as I grew older, I realized that girls might have the opportunity to participate in informal peace processes, but when it gets to the formal peace processes, they don't have mentorship, which becomes a critical issue for me because I've tried to write to so many, for instance, women leaders in the African context who are on peace and security, and they're few and very busy and they cannot give me, for instance, the mentorship that I have. Well, now I'm lucky to be part of fellowship programs that help me, but do you have a strategy or any best practice that girls can really be mentored into working in the field of peace and security, especially at the very formal top level? Thank you. Great, thank you for your good questions. We have three questions, how you encourage women who face persecution, challenges when girls do go to school about harassment and mentoring in peace and security programs at the national level. Who would like to start? I can go first, and to the first question of coping up with the trauma, there is a lot of trauma in generally in a place which is so much, there is a lot of violence and armed conflict, but the strategy that we are using is that we have another program which is trauma healing of women and girls, and in which we have actually worked with some local counselors to teach them some of the methodologies and to train them that how they can work in their own communities to help other girls to heal and to cope up with this trauma. We have worked with some teachers also in our community to give them those skills that how they can use different local methodologies and how they can work with other girls who have been affected by the armed conflict. And as there are members of the Youth Peace Network, they're girls, we're working with girls, and we are aware that working on peace is a very risky job in the north-east of Pakistan. So we have also developed a security policy for our organization when my family was also attacked and we had to move our offices many times. So we have developed a partnership with some of the law enforcement institutions in order to kind of ensure that the people who are engaged in our programs, they're also secured and sometimes we'll, what we are using different like mitigation strategies, like we never share on our social media about any activity in programs that are happening on the ground. We will share, for example, after a week or after two weeks that, okay, this program happened. So like using different strategies, keeping changing some of the names while we share some of the stories. So to make sure that they are not at risk and their lives are not at risk because of some of the programs. To the other question, which was and harass the challenges that girls face while they go to school. And as it has been mentioned, that harassment is one of the issue, yes, it is. And there is another area in the Kheber-Bukhton-Khoi it's called Buneer and while we were working there, there are many parents who wanted their girls to go to school and usually, because usually there is also this perception that parents do not want their girls to go, do you know, to send to schools. And these parents were no, there are, the problem is that the school is so far and the girls face harassment when they go out of their homes that we have to see that what is priority for us, whether it's the safety of these girls or whether it's their education. And that's why parents then have to choose among one of these things and they chose for their girls to be safe and that's why not to go to school. And this is, so this is a very challenge that came up but what we actually did was there are now, in 2011 there were laws in Pakistan, they passed on anti-sexual harassment at work places and in public spaces and what we have done is we actually work in communities but also with girls, with young girls who are in eighth, ninth and tenth grade to educate them about this law and that what the law says we have also worked with some of the educational institutes to ensure that the anti-sexual harassment committees are there and they are working and they are being effective there and people know that this law exists and we have also telling girls about that how they can report any incidences even to the local police stations or two so that they know that this is something that happens but also what are the mechanisms to cope up with these issues. So I'll answer the question about mentoring because that is probably my favorite topic besides from girls. I'm the product of a mentor, of amazing mentoring. When I was born, I was actually born in one of the poorest countries and in fact the GDP of my birth country was less than Uganda when I was born and today it's South Korea. In my lifetime, I've been able to see amazing transformation of my birth country. What's even more amazing is that when my mother was born, South Korea was getting foreign aid from North Korea. So we do believe yes we can. I am actually standing on shoulders of women that made this possible. So I'm a huge proponent of finding mentor and in fact from working for the U.S. government I went directly to a huge organization, an institution, a hundred year old institution that has perfected girls leadership development and it's called Girl Scouts. So I work with 2.3 million girls in United States and 10 million girls around the world and the year that I joined to develop their global department, 93% of women in Congress were former Girl Scouts. So mentoring we know works and if you want to know more because I see a huge in-sign in front of me, please find me after this talk. As Jin says, we need to end this session and we will be here afterwards if you have further questions. I think it's so important that AFP and USIP included this topic in this conference agenda. Thank you, thank you, to acknowledge the courage and the commitment of both Sabah and Jin for all you're doing to bring this issue to all of our awareness and thank you for speaking today. Please join me in thanking them. I'd like to turn it back to Nancy Lindborg from USIP. What a great day. Really all I want to do is come back to thank everybody for joining this important day. Thank everybody who was a panelist, who asked a question, who joined us today, the moderators, the speakers, attendees for sharing your energy, your ideas. I think it's a lot of practical strategies and engaging in conversation that is a very important one to have right now as we collectively seek to look, how do we build peace? How do we prevent conflict and end violence? This is, as we said this morning, the sixth year. I think it's a more important moment than ever before that we've come together for these conferences. I couldn't be more pleased to be able to partner with the Alliance for Peacebuilding. Melanie will tell you all about what's to come, but congratulations on a wonderful first day, a very dynamic day, and I look forward to hearing how the rest of the conference goes. Thank you for joining us here at USIP. At the end of every Passover Seder, we say next year in Jerusalem, I'd like to say next year at 2301 Constitution Avenue. So thank you, Nancy, again, for your partnership. Thank you all, and I can't thank our panel enough. This was such, I feel we had one kind of inspiration at the beginning of the day and a very different kind of inspiration at the end of the day. And somehow those two are joining up in very powerful ways. So I feel inspired by your story and I know that everyone in this room joins me in offering our help to you in this mission to empower girls. So thank you. So as we come to the end of our first day, just a couple of reminders. The first is the Peacebuilding Evaluation Consortium, candidate surveys. We take learning and information and data seriously. If you would please fill those out and leave them before you leave, we'd be very appreciative. Second, if any of you are not staying for the next two days but have a hard copy program, if you could please leave that in the front that will help us tomorrow for the people who are coming tomorrow who didn't have a program. If you are coming tomorrow and you have a program, keep it, because we don't have extras to give tomorrow. Moving on to happier things. Tomorrow, there will be a happy hour from six o'clock to 7.30. We invite all of you, even if you aren't at the conference tomorrow, at the Mission Restaurant in Dupont Circle. It's jointly sponsored by USIP and the Nonviolent Social Movement Group within USIP and by Peace Direct. So please, we welcome you there. I just leave you with this comment which is one of our participants today said, when I come here, I feel like it's a family reunion. And so I want to thank this family of peace builders. I feel I see Chick Donbuck sitting here at the back that we stretch through most of AFP's history and to say how privileged I feel to be part of this family and to say thank you and welcome to all of you tomorrow and that I hope all of you will bring the spirit of peace and joy with you for the rest of the week. Thank you.