# Parallel/Multi-thread element code generation using AceGen

I am using AceGen to generate source code for finite element simulations in AceFEM. I have elements with a very large number of vertices/degrees of freedom which can take a very long time to compile.

I know that in AceFEM the command SMTInputData["Threads" -> 16]; can be used to run the solver over 16 threads.

Is there an equivalent command that can be used for AceGen to allow for parallelization of the source code compilation procedure?

1. You are using a Mathematica command that takes all the time (e.g. Simplify). This would no be AceGen related problem.
2. You are generating all components of tangent explicitly (e.g. SMSD[R,p]) for large number of DOFs. In this case you should make a loop and generate characteristic formulae (e.g. SMSDo[ SMSD[R,p,i], {i,1,nDOF}])
• In the formulation I create a matrix A that has dimensions $2nNodes \times 6$ from which I create a matrix B where B=IdentityMatrix[2nNodes]-A.SMSInverse[Transpose[A].A].Transpose[A]. It seems so be the construction of B that is slowing down the code generation. With the construction of B omitted the compilation takes 7 seconds for 4 nodes. However, with constructing B it takes 51 seconds. When nNodes gets to about 30 it can take a full day to compile. @JozeK @Pinti is there a way to speed this up? May 12, 2021 at 12:47