Skip to content

Commit

Permalink
'changes'
Browse files Browse the repository at this point in the history
  • Loading branch information
risi-kondor committed Oct 25, 2023
1 parent db7189b commit 596ccb2
Show file tree
Hide file tree
Showing 25 changed files with 6,259 additions and 3 deletions.
146 changes: 146 additions & 0 deletions NONCOMMERCIAL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
NON_COMMERICAL SOFTWARE LICENSE FOR THE GELIB SOFTWARE LIBRARY

Copyright (c) 2021- Imre (Risi) Kondor. All rights reserved.


DEFINITIONS

"Program" means a copy of the GELIB software library or parts of the GELIB software library explicitly
marked in the source code as distributed under this Noncommercial Software License.

"Copyright holder" means the author of GELIB, Imre Kondor, who retains the copyright to Program.

"Work based on the Program" means either the Program or any derivative work under copyright law: that is
to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included without limitation in the term
"modification".)

"Using the Program" means any act of creating executables that contain or directly use libraries that
are part of the Program, running any part of the Program or any tools that are part of the Program, or
creating works based on the Program.

Each licensee is addressed as "you".


TERMS AND CONDITIONS FOR USE, COPYING, DISTRIBUTION AND MODIFICATION

1. This License grants you permission to use the Program free of charge for any noncommercial purpose,
including teaching and research at universities, colleges and other educational institutions, research
at non-profit research institutions, and personal non-profit purposes.

2. This License does NOT grant permission to use the Program for commercial purposes, including but not
restricted to (a) bundling or integrating the Program with any hardware product or any other software for
transfer, sale or license to a third party (even if distributing the Program on separate media and not
charging for the Program); (b) providing customers with a link to the Program or a copy of the Program
for use with hardware or another program purchased by that customer; or (c) use in connection with the
performance of services for which you are compensated (d) use in connection with research and development
activities in the service of developing commercial products or obtaining patents for derived products
such as pharmaceuticals; (e) other forms of indirect commercial use, such as on a website that accepts
advertising money for content.

3. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any
medium, provided that you retain the copyright notice on each file of the source code and conspicuously
and appropriately include a copy of this License and Disclaimer of Warranty with the Program in a file
named LICENSE.TXT.

4. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on
the Program, and copy and distribute such modifications or work under the terms of Section 2 above,
provided that:

a) You cause the modified files to carry prominent notices stating that you changed the files and the
date of any change.

b) You cause any work that you distribute or publish, that in whole or in part contains or is derived
from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under
the terms of this License.

c) You retain the original copyright notice on each file of this Program's source code and conspicuously
include a copy of this License and Disclaimer of Warranty under the terms described in Section 3.

These requirements apply to the modified work as a whole. If identifiable sections of that work are not
derived from the Program, and can be reasonably considered independent and separate works in themselves,
then this License, and its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a work based on the Program,
the distribution of the whole must be on the terms of this License, whose regulations for other licensees
extend to the entire whole, and thus to each and every part regardless of who wrote it. (If the same,
independent sections are distributed as part of a package that is otherwise reliant on, or is based on
the Program, then the distribution of the whole package, including but not restricted to the independent
section, must be on the unmodified terms of this License, regadless of who the author of the included
sections was.)

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely
by you; rather, the intent is to exercise the right to control the distribution of derivative or collective
works based or reliant on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work
based on the Program) on a volume of storage or distribution medium does not bring the other work under
the scope of this License.

5. You may copy and distribute the Program (or a work based on it, under Section 3) in object code or
executable form under the terms of Sections 3 and 4 above provided that you also accompany it with the
complete corresponding machine-readable source code under the terms of Sections 3 and 4, as well as the
License and Disclaimer of Warranty, under the terms of Section 3.

If distribution of executable or object code is made by offering access to copy from a designated place,
then offering equivalent access to copy the source code from the same place counts as distribution of the
source code, even though third parties are not compelled to copy the source along with the object code.

6. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this
License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will
automatically terminate your rights under this License. However, parties who have received copies, or rights,
from you under this License will not have their licenses terminated so long as such parties remain in full
compliance.

7. You are not required to accept this License, since you have not signed it. Nothing else grants you
permission to modify or distribute the Program or its derivative works; law prohibits these actions if you
do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License and all its terms and conditions for copying,
distributing or modifying the Program or works based on it, to do so.

8. Each time you redistribute the Program (or any work based on the Program), the recipient automatically
receives a license from the original licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the recipients to exercise the
rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

9. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason
(not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise)
that contradict the conditions of this License, they do not excuse you from the conditions of this License.
If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a
patent license would not permit royalty-free redistribution of the Program by all those who receive copies
directly or indirectly through you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program. If any portion of this section is held invalid or
unenforceable under any particular circumstance, the balance of the section is intended to apply and the
section as a whole is intended to apply in other circumstances.

10. If the distribution and/or use of the Program are restricted in certain countries either by patents or
by copyrighted interfaces, the original copyright holder who places the Program under this License may add an
explicit geographical distribution limitation excluding those countries, so that distribution is permitted
only in or among countries not thus excluded. In such case, this License incorporates the limitation as if
written in the body of this License.

11. Copyright holder retains the right to grant broader rights to the Program to individuals or to commercial
entities on a case by case basis, possibly for a fee.


DISCLAIMER OF WARRANTY

12. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED ON IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY
OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.








2 changes: 1 addition & 1 deletion common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SO2DIR=$(ROOTDIR)/objects/SO2
SO3DIR=$(ROOTDIR)/objects/SO3
SO3NDIR=$(ROOTDIR)/objects/SO3n
SO3CDIR=$(ROOTDIR)/objects/SO3c
GELIB_CUDADIR=$(ROOTDIR)/../GElib-cuda/cuda
GELIB_CUDADIR=$(ROOTDIR)/cuda

# COMBINATORIALDIR=$(ROOTDIR)/objects/combinatorial
# GROUPSDIR=$(ROOTDIR)/objects/groups
Expand Down
19 changes: 19 additions & 0 deletions cuda/GElib_base.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This file is part of GElib, a C++/CUDA library for group equivariant
* tensor operations.
*
* Copyright (c) 2023, Imre Risi Kondor
*
* This source code file is subject to the terms of the noncommercial
* license distributed with GElib in the file NONCOMMERICAL.TXT. Commercial
* use is prohibited. All redistributed versions of this file (in orginal
* or modified form) must retain this copyright notice and must be
* accompanied by a verbatim copy of the license.
*
*/

#include <cuda.h>
#include <cuda_runtime.h>
#include "GElib_base.hpp"

__device__ __constant__ unsigned char cg_cmem[CNINE_CONST_MEM_SIZE];
54 changes: 54 additions & 0 deletions cuda/Generate_SO3part_addCGproduct_kernel_calls.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of GElib, a C++/CUDA library for group
* equivariant tensor operations.
*
* Copyright (c) 2023, Imre Risi Kondor
*
* This source code file is subject to the terms of the noncommercial
* license distributed with GElib in the file NONCOMMERICAL.TXT. Commercial
* use is prohibited. All redistributed versions of this file (in
* original or modified form) must retain this copyright notice and
* must be accompanied by a verbatim copy of the license.
*
*/

#include "GElib_base.cpp"
#include "GElibSession.hpp"
#include <fstream>

using namespace cnine;
using namespace GElib;

const int maxl1=2;
const int maxl=4;


int main(int argc, char** arg){

ofstream ofs("SO3part_addCGproduct_explicit_calls.inc");

ofs<<" switch(l1){\n";
for(int l1=0; l1<=maxl1; l1++){
ofs<<" case "<<l1<<":\n";

ofs<<" switch(l2){\n";
for(int l2=0; l2<=maxl1; l2++){
ofs<<" case "<<l2<<":\n";

ofs<<" switch(l){\n";
for(int l=std::abs(l1-l2); l<=l1+l2 && l<=maxl; l++){
ofs<<" case "<<l<<": ";
ofs<<"SO3part_addCGproduct_explicit<SO3part_addCGproduct_explicit_kernel_"<<l1<<"_"<<l2<<"_"<<l<<">"
<<"<<<b,cnine::roundup(y.n2,32),nlines*128,stream>>>(r,x,y); break;"<<endl;
}
ofs<<" }"<<endl;
ofs<<" break;"<<endl;
}
ofs<<" }"<<endl<<endl;
ofs<<" break;"<<endl;

}
ofs<<" }"<<endl;

ofs.close();
}
79 changes: 79 additions & 0 deletions cuda/Generate_SO3part_addCGproduct_subkernels.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* This file is part of GElib, a C++/CUDA library for group
* equivariant tensor operations.
*
* Copyright (c) 2023, Imre Risi Kondor
*
* This source code file is subject to the terms of the noncommercial
* license distributed with GElib in the file NONCOMMERICAL.TXT. Commercial
* use is prohibited. All redistributed versions of this file (in
* original or modified form) must retain this copyright notice and
* must be accompanied by a verbatim copy of the license.
*
*/

#include "GElib_base.cpp"
#include "GElibSession.hpp"
#include <fstream>

extern GElib::SO3_CGbank SO3_cgbank;

using namespace cnine;
using namespace GElib;

const int maxl1=2;
const int maxl=4;


int main(int argc, char** arg){

ofstream ofs("SO3part_addCGproduct_subkernels.inc");

for(int l1=0; l1<=maxl1; l1++){

for(int l2=0; l2<=maxl1; l2++){

for(int l=std::abs(l1-l2); l<=l1+l2 && l<=maxl; l++){
auto& C=SO3_cgbank.getf(CGindex(l1,l2,l));

ofs<<"__forceinline__ __device__ void SO3part_addCGproduct_explicit_kernel_"<<l1<<"_"<<l2<<"_"<<l<<
"(const float* xpr, const float* xpi, const float* ypr, const float* ypi, const int ys, float* rpr, float* rpi, const int rs){"<<endl;

for(int m=-l; m<=l; m++){

ofs<<" rpr["<<m+l<<"*rs]+="<<endl;
for(int m1=max(-l1,m-l2); m1<=min(l1,m+l2); m1++){
int m2=m-m1;
float c=C(m1+l1,m2+l2);
string cs=to_string(c);
//if(c==floor(c)) cs=cs+".";
//c=1.0;
ofs<<" ("<<cs<<"f)*(xpr["<<m1+l1<<"]*ypr["<<m2+l2<<"*ys]-xpi["<<m1+l1<<"]*ypi["<<m2+l2<<"*ys])";
if(m1<min(l1,m+l2)) ofs<<"+"<<endl;
}
ofs<<";"<<endl;

ofs<<" rpi["<<m+l<<"*rs]+="<<endl;
for(int m1=max(-l1,m-l2); m1<=min(l1,m+l2); m1++){
int m2=m-m1;
float c=C(m1+l1,m2+l2);
string cs=to_string(c);
//if(c==floor(c)) cs=cs+".";
//c=1.0;
ofs<<" ("<<cs<<"f)*(xpr["<<m1+l1<<"]*ypi["<<m2+l2<<"*ys]+xpi["<<m1+l1<<"]*ypr["<<m2+l2<<"*ys])";
if(m1<min(l1,m+l2)) ofs<<"+"<<endl;
}
ofs<<";"<<endl;

}

ofs<<"}"<<endl<<endl;

}
}
}

ofs.close();


}
38 changes: 38 additions & 0 deletions cuda/SO3CGproducts_combo.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* This file is part of GElib, a C++/CUDA library for group equivariant
* tensor operations.
*
* Copyright (c) 2023, Imre Risi Kondor
*
* This source code file is subject to the terms of the noncommercial
* license distributed with GElib in the file NONCOMMERICAL.TXT. Commercial
* use is prohibited. All redistributed versions of this file (in orginal
* or modified form) must retain this copyright notice and must be
* accompanied by a verbatim copy of the license.
*
*/

#include <cuda.h>
#include <cuda_runtime.h>
#include "GElib_base.hpp"

__device__ __constant__ unsigned char cg_cmem[CNINE_CONST_MEM_SIZE];
#define _SO3CG_CUDA_CONCAT

//#include "SO3partA_CGproduct.cu"
//#include "SO3partA_DiagCGproduct.cu"

#include "SO3partB_addCGproduct.cu"
#include "SO3partB_addCGproduct_back0.cu"
#include "SO3partB_addCGproduct_back1.cu"

#include "SO3partB_addDiagCGproduct.cu"
#include "SO3partB_addDiagCGproduct_back0.cu"
#include "SO3partB_addDiagCGproduct_back1.cu"

#include "SO3Fpart_addFproduct.cu"
#include "SO3Fpart_addFproduct_back0.cu"
#include "SO3Fpart_addFproduct_back1.cu"

#include "SO3part_addCGtransform.cu"

Loading

0 comments on commit 596ccb2

Please sign in to comment.