Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Kirk, Benjamin (JSCEG) <Benjamin.K<irk1@na...>  20081106 00:22:45

>> Could the api allow you to specify the indices from userspace? The >> reason I ask is because if all your variables are the same type it >> is pretty easy to figure out the range from the first_local_index, >> last_local_index, n_vars, and var_num. >> >> That's a little hackish to do inside the library... > > A *little* hackish? No, requiring the command line option > "node_major_dofs" to use that coefficient numbering, that was a > little hackish. *Breaking* that option (as well as TaylorHood > elements, etc.) would be a *lot* hackish. ;) > But as an optimization which could fall back on my more general code, > it's a very good idea. Use NumericVector::subrange_norm() only if > we're using varmajor numbering, and have the DofMap cache the > first_local_index_var[n] for each variable so we get the range limits > right even if there's differing FE types in use. Yeah, of course you're right... For only a tiny bit of library code we can put together something that might be quite useful. So, what do you think about something like std:pair<unsigned int, unsigned int> local_dof_index_range = DofMap::local_dof_index_range (unsigned int var_num = 1); (where I have obviously taken some liberty combining a function call with its prototype)? When called without a var_num argument we just return std::make_pair(first_local_index, last_local_index); otherwise the relevant bounds for var_num? Ben 
From: Kirk, Benjamin (JSCEG) <Benjamin.K<irk1@na...>  20081105 22:14:41

What about a scaled_norm of sorts where you can weight each variable by a constant? Yours is then just a special case with a one and some zeros?  Original Message  From: Derek Gaston <friedmud@...> To: libmeshusers@... <libmeshusers@...> Sent: Wed Nov 05 16:08:09 2008 Subject: [Libmeshusers] Norm of a NumericVector for specific variable... Anyone have a good piece of code for computing a norm of just the piece of a NumericVector that corresponds to a specific variable number? My problem is that I have multiple variables in my system... but I need to get the norm of the residual for each one individually. Should we maybe extend the l2_norm(), l1_norm(), linfty_norm() functions to take an option variable number? Derek  This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblincontest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libmeshusers mailing list Libmeshusers@... https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Kirk, Benjamin (JSCEG) <Benjamin.K<irk1@na...>  20081105 23:47:29

Unfortunately there is nothing in the library that is generic to find all local dof indices for a specific variable. Could the api allow you to specify the indices from userspace? The reason I ask is because if all your variables are the same type it is pretty easy to figure out the range from the first_local_index, last_local_index, n_vars, and var_num. That's a little hackish to do inside the library... What if NumericVector allowed a subrange_norm()? Seems like we should eventually implement the block sparse matrix and vector variants  that would make it really easy. I've often wondered if there would be much of a performance gain on the linear algebra side.  Original Message  From: Derek Gaston <friedmud@...> To: Roy Stogner <roy@...> Cc: libmeshusers@... <libmeshusers@...> Sent: Wed Nov 05 17:27:57 2008 Subject: Re: [Libmeshusers] Norm of a NumericVector for specific variable... On Nov 5, 2008, at 4:09 PM, Roy Stogner wrote: > In fact, I think we'll want to hand this norm off to NumericVector in > the end too, providing it with a cloned NumericVector whose > coefficients are set to the proper weights given in the SystemNorm, so > it just has to call the linear algebra package to pointwise multiply > and then take a norm. This makes sense to me. >> So... now my question is... is there a way to get a list of all of >> the DofIndices for a variable on a processor? Or am I going to >> have to loop over each element calling dof_map>dof_indices() and >> passing in the variable to build up this list? > > I don't see any way, no. Maybe Ben knows of something I'm forgetting. Hopefully. > But at least you won't have to loop over *every* element  you just > need to know which local DoFs belong to your variable. Right... just loop over local elements. Well... I guess I'll start writing something... Derek  This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblincontest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libmeshusers mailing list Libmeshusers@... https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Roy Stogner <roystgnr@ic...>  20081106 00:04:12

On Wed, 5 Nov 2008, Kirk, Benjamin (JSCEG) wrote: > Could the api allow you to specify the indices from userspace? The > reason I ask is because if all your variables are the same type it > is pretty easy to figure out the range from the first_local_index, > last_local_index, n_vars, and var_num. > > That's a little hackish to do inside the library... A *little* hackish? No, requiring the command line option "node_major_dofs" to use that coefficient numbering, that was a little hackish. *Breaking* that option (as well as TaylorHood elements, etc.) would be a *lot* hackish. ;) But as an optimization which could fall back on my more general code, it's a very good idea. Use NumericVector::subrange_norm() only if we're using varmajor numbering, and have the DofMap cache the first_local_index_var[n] for each variable so we get the range limits right even if there's differing FE types in use.  Roy 
From: Derek Gaston <friedmud@gm...>  20081106 00:29:14

So... after hashing this out with some people around here... I'm now thinking that the vector multiply and call linear algebra package norm is a bad idea. Firstly, we have some systems where we're solving up to 9 variables! That means we'd have to do all of that stuff every time.... not too mention wasting memory with all of the zeroes hanging around in that vector.... I'm thinking now of a NumericVector::subset_norm() that takes a std::set of the local dof indices to perform the norm on and a norm type (or we could make separate norm functions... either way). The std::set could easily be created in System::calculate_norm() for each variable that you want the discrete norm for and then call subset_norm() the appropriate number of times. And here's where it gets nutty: we just do our own damn norm calculation. It's not like it's rocket science. We do it right in NumericVector using the interface functions (like operator() ) so that every NumericVector gets this capability. What do you think? Derek On Nov 5, 2008, at 5:03 PM, Roy Stogner wrote: > > > On Wed, 5 Nov 2008, Kirk, Benjamin (JSCEG) wrote: > >> Could the api allow you to specify the indices from userspace? The >> reason I ask is because if all your variables are the same type it >> is pretty easy to figure out the range from the first_local_index, >> last_local_index, n_vars, and var_num. >> >> That's a little hackish to do inside the library... > > A *little* hackish? No, requiring the command line option > "node_major_dofs" to use that coefficient numbering, that was a > little hackish. *Breaking* that option (as well as TaylorHood > elements, etc.) would be a *lot* hackish. ;) > > But as an optimization which could fall back on my more general code, > it's a very good idea. Use NumericVector::subrange_norm() only if > we're using varmajor numbering, and have the DofMap cache the > first_local_index_var[n] for each variable so we get the range limits > right even if there's differing FE types in use. >  > Roy 
From: Kirk, Benjamin (JSCEG) <Benjamin.K<irk1@na...>  20081106 00:22:45

>> Could the api allow you to specify the indices from userspace? The >> reason I ask is because if all your variables are the same type it >> is pretty easy to figure out the range from the first_local_index, >> last_local_index, n_vars, and var_num. >> >> That's a little hackish to do inside the library... > > A *little* hackish? No, requiring the command line option > "node_major_dofs" to use that coefficient numbering, that was a > little hackish. *Breaking* that option (as well as TaylorHood > elements, etc.) would be a *lot* hackish. ;) > But as an optimization which could fall back on my more general code, > it's a very good idea. Use NumericVector::subrange_norm() only if > we're using varmajor numbering, and have the DofMap cache the > first_local_index_var[n] for each variable so we get the range limits > right even if there's differing FE types in use. Yeah, of course you're right... For only a tiny bit of library code we can put together something that might be quite useful. So, what do you think about something like std:pair<unsigned int, unsigned int> local_dof_index_range = DofMap::local_dof_index_range (unsigned int var_num = 1); (where I have obviously taken some liberty combining a function call with its prototype)? When called without a var_num argument we just return std::make_pair(first_local_index, last_local_index); otherwise the relevant bounds for var_num? Ben 
From: Roy Stogner <roystgnr@ic...>  20081106 00:56:12

On Wed, 5 Nov 2008, Kirk, Benjamin (JSCEG) wrote: > Yeah, of course you're right... For only a tiny bit of library code > we can put together something that might be quite useful. So, what > do you think about something like > > std:pair<unsigned int, unsigned int> local_dof_index_range = > DofMap::local_dof_index_range (unsigned int var_num = 1); > > (where I have obviously taken some liberty combining a function call with its prototype)? > > When called without a var_num argument we just return > > std::make_pair(first_local_index, last_local_index); > > otherwise the relevant bounds for var_num? Assuming relevant bounds exist. Return (1, 1) when they don't? Sounds good, anyway.  Roy 
From: Kirk, Benjamin (JSCEG) <Benjamin.K<irk1@na...>  20081106 00:52:46

I see your nutty and raise you batshit crazy: PETSc allows you to provide your own buffer for storing the local elements when you create a vector... Does Trilinos have something similar? If so, I propose we take the implementation in DistributedVector, push it down into NumericVector, and beef it up. If both PETSc and Trilinos allow the user to manage the local element storage, that could certainly be exploited for performance. operator(i) would be inline with some error checking and then return _val[iifirst] or something like that... no embedded function call. We would still let PETSc do summation to remote values and that sort of thing. Can you see if trilinos would allow something like this? If so, I'd like to do it. I've resisted implementing a sparse parallel matrix, not so much because it is hard but more because that seems like a slippery slope to writing Krylov solvers and, ultimately parallel preconditioners... All of which are wheels we need not reinvent. But this? Why not... Ben Original Message From: Derek Gaston [mailto:friedmud@...] Sent: Wed 11/5/2008 6:27 PM To: Roy Stogner Cc: Kirk, Benjamin (JSCEG); libmeshusers@... Subject: Re: [Libmeshusers] Norm of a NumericVector for specific variable... So... after hashing this out with some people around here... I'm now thinking that the vector multiply and call linear algebra package norm is a bad idea. Firstly, we have some systems where we're solving up to 9 variables! That means we'd have to do all of that stuff every time.... not too mention wasting memory with all of the zeroes hanging around in that vector.... I'm thinking now of a NumericVector::subset_norm() that takes a std::set of the local dof indices to perform the norm on and a norm type (or we could make separate norm functions... either way). The std::set could easily be created in System::calculate_norm() for each variable that you want the discrete norm for and then call subset_norm() the appropriate number of times. And here's where it gets nutty: we just do our own damn norm calculation. It's not like it's rocket science. We do it right in NumericVector using the interface functions (like operator() ) so that every NumericVector gets this capability. What do you think? Derek On Nov 5, 2008, at 5:03 PM, Roy Stogner wrote: > > > On Wed, 5 Nov 2008, Kirk, Benjamin (JSCEG) wrote: > >> Could the api allow you to specify the indices from userspace? The >> reason I ask is because if all your variables are the same type it >> is pretty easy to figure out the range from the first_local_index, >> last_local_index, n_vars, and var_num. >> >> That's a little hackish to do inside the library... > > A *little* hackish? No, requiring the command line option > "node_major_dofs" to use that coefficient numbering, that was a > little hackish. *Breaking* that option (as well as TaylorHood > elements, etc.) would be a *lot* hackish. ;) > > But as an optimization which could fall back on my more general code, > it's a very good idea. Use NumericVector::subrange_norm() only if > we're using varmajor numbering, and have the DofMap cache the > first_local_index_var[n] for each variable so we get the range limits > right even if there's differing FE types in use. >  > Roy 
From: Roy Stogner <roystgnr@ic...>  20081106 01:29:02

On Wed, 5 Nov 2008, Kirk, Benjamin (JSCEG) wrote: > If both PETSc and Trilinos allow the user to manage the local element > storage, that could certainly be exploited for performance. operator(i) > would be inline Good. > with some error checking (in debug/devel mode only) > and then return _val[iifirst] or something like that... no > embedded function call. We would still let > PETSc do summation to remote values and that sort of thing. > > Can you see if trilinos would allow something like this? If so, I'd like > to do it. So your proposal is "Let's implement this performance improvement that we should have done years ago, and I'll do all the work"? I can see how that last clause might qualify as "batshit crazy" from your perspective, but it sounds great to me!  Roy 
Sign up for the SourceForge newsletter:
No, thanks