log refactor, before doing atomphys stuff probably
This commit is contained in:
parent
48b67775f8
commit
c8da051f32
1
.gitignore
vendored
1
.gitignore
vendored
@ -88,6 +88,7 @@ dkms.conf
|
|||||||
*.la
|
*.la
|
||||||
*.a
|
*.a
|
||||||
*.lib
|
*.lib
|
||||||
|
*.rdi
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
*.exe
|
*.exe
|
||||||
|
|||||||
@ -26,9 +26,13 @@ IF NOT EXIST .\build mkdir .\build
|
|||||||
pushd .\build
|
pushd .\build
|
||||||
rem cl /c %CommonCompilerFlags% %Sources% /I"%mkl_root%\include"
|
rem cl /c %CommonCompilerFlags% %Sources% /I"%mkl_root%\include"
|
||||||
rem FOR MSVC /link %mkl_core% %mkl_intel_lp64% %mkl_intel_thread% %libiomp5md%
|
rem FOR MSVC /link %mkl_core% %mkl_intel_lp64% %mkl_intel_thread% %libiomp5md%
|
||||||
nvcc -c %CudaSources% -o %CudaObj% -g -G -lcusolver
|
rem nvcc -c %CudaSources% -o %CudaObj% -g -G -lcusolver
|
||||||
rem nvcc -o program.exe -lcusolver -L%mkl_root%/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_intel_thread -l%MKLCOMPILER%/lib/intel64_win/libiomp5md
|
rem nvcc -o program.exe -lcusolver -L%mkl_root%/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_intel_thread -l%MKLCOMPILER%/lib/intel64_win/libiomp5md
|
||||||
cl %CommonCompilerFlags% %Sources% /I"%mkl_root%\include" /link %CudaObj% %cuda_root%/cudart.lib %cuda_root%/cusolver.lib %mkl_core% %mkl_intel_lp64% %mkl_intel_thread% %libiomp5md%
|
rem cl %CommonCompilerFlags% %Sources% /I"%mkl_root%\include" /link %CudaObj% %cuda_root%/cudart.lib %cuda_root%/cusolver.lib %mkl_core% %mkl_intel_lp64% %mkl_intel_thread% %libiomp5md%
|
||||||
|
|
||||||
|
|
||||||
|
cl %CommonCompilerFlags% %Sources% /I"%mkl_root%\include" /link %mkl_core% %mkl_intel_lp64% %mkl_intel_thread% %libiomp5md%
|
||||||
|
|
||||||
set LastError=%ERRORLEVEL%
|
set LastError=%ERRORLEVEL%
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|||||||
34
src/main.c
34
src/main.c
@ -1,5 +1,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define ENABLE_LOGGING 1
|
||||||
|
#if ENABLE_LOGGING
|
||||||
|
#define LOG(msg) { OutputDebugString(msg); }
|
||||||
|
#else
|
||||||
|
#define LOG(msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
// Header includes
|
// Header includes
|
||||||
#include "base/base_inc.h"
|
#include "base/base_inc.h"
|
||||||
@ -7,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// CUDA headers
|
// CUDA headers
|
||||||
#include "kernels.h"
|
//#include "kernels.h"
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
// .C includes
|
// .C includes
|
||||||
@ -21,8 +28,6 @@
|
|||||||
#define knotpoints_file_path "D:\\dev\\eigsol_gpu\\out\\knotpoints.dat"
|
#define knotpoints_file_path "D:\\dev\\eigsol_gpu\\out\\knotpoints.dat"
|
||||||
#define bspline_array_file_path "D:\\dev\\eigsol_gpu\\out\\bsplines.dat"
|
#define bspline_array_file_path "D:\\dev\\eigsol_gpu\\out\\bsplines.dat"
|
||||||
|
|
||||||
global U32 enable_logging = 1;
|
|
||||||
|
|
||||||
// Complex number with double precision
|
// Complex number with double precision
|
||||||
typedef struct Z64 Z64;
|
typedef struct Z64 Z64;
|
||||||
struct Z64
|
struct Z64
|
||||||
@ -57,17 +62,6 @@ struct BSplineCtx
|
|||||||
global Grid g_grid = {0};
|
global Grid g_grid = {0};
|
||||||
global BSplineCtx g_bspline_ctx = {0};
|
global BSplineCtx g_bspline_ctx = {0};
|
||||||
|
|
||||||
//~ Functions
|
|
||||||
|
|
||||||
function inline void
|
|
||||||
logger_debug(String8 msg)
|
|
||||||
{
|
|
||||||
OutputDebugString(msg.str);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LOG(msg) if(enable_logging) { logger_debug(msg) };
|
|
||||||
|
|
||||||
|
|
||||||
function void
|
function void
|
||||||
write_array_binary_F64(String8 path_to_file, F64 *values, U32 array_size)
|
write_array_binary_F64(String8 path_to_file, F64 *values, U32 array_size)
|
||||||
{
|
{
|
||||||
@ -89,7 +83,7 @@ write_array_binary_F64(String8 path_to_file, F64 *values, U32 array_size)
|
|||||||
join.sep = str8_lit(" ");
|
join.sep = str8_lit(" ");
|
||||||
join.post = str8_lit("\n");
|
join.post = str8_lit("\n");
|
||||||
String8 log_msg = str8_list_join(scratch.arena, log_list, &join);
|
String8 log_msg = str8_list_join(scratch.arena, log_list, &join);
|
||||||
OutputDebugString(log_msg.str);
|
LOG(log_msg.str);
|
||||||
}
|
}
|
||||||
OS_file_close(file_handle);
|
OS_file_close(file_handle);
|
||||||
}
|
}
|
||||||
@ -112,7 +106,7 @@ write_string_list_to_file(Arena *arena, String8 path, String8List *list)
|
|||||||
join.sep = str8_lit(" ");
|
join.sep = str8_lit(" ");
|
||||||
join.post = str8_lit("\n");
|
join.post = str8_lit("\n");
|
||||||
String8 log_msg = str8_list_join(arena, log_list, &join);
|
String8 log_msg = str8_list_join(arena, log_list, &join);
|
||||||
OutputDebugString(log_msg.str);
|
LOG(log_msg.str);
|
||||||
}
|
}
|
||||||
OS_file_close(file_handle);
|
OS_file_close(file_handle);
|
||||||
}
|
}
|
||||||
@ -336,8 +330,14 @@ void EntryPoint(void)
|
|||||||
//- Test MKL
|
//- Test MKL
|
||||||
test_mkl_zgeev();
|
test_mkl_zgeev();
|
||||||
test_mkl_dsyevd();
|
test_mkl_dsyevd();
|
||||||
cuda_entry_point();
|
|
||||||
|
|
||||||
|
LOG("\n\n---- Skipping CUDA part for now ---- \n\n");
|
||||||
|
//cuda_entry_point();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LOG("\n\n--- End of EntryPoint, exiting program. \n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ test_mkl_zgeev(void) {
|
|||||||
{-9.87, 4.82}, {-3.15, 7.36}, {-0.75, 5.23}, { 4.59, 5.41}
|
{-9.87, 4.82}, {-3.15, 7.36}, {-0.75, 5.23}, { 4.59, 5.41}
|
||||||
};
|
};
|
||||||
/* Executable statements */
|
/* Executable statements */
|
||||||
OutputDebugString( " ZGEEV Example Program Results\n" );
|
LOG( " ZGEEV Example Program Results\n" );
|
||||||
/* Query and allocate the optimal workspace */
|
/* Query and allocate the optimal workspace */
|
||||||
lwork = -1;
|
lwork = -1;
|
||||||
zgeev( "Vectors", "Vectors", &n, a, &lda, w, vl, &ldvl, vr, &ldvr,
|
zgeev( "Vectors", "Vectors", &n, a, &lda, w, vl, &ldvl, vr, &ldvr,
|
||||||
@ -105,7 +105,7 @@ test_mkl_zgeev(void) {
|
|||||||
work, &lwork, rwork, &info );
|
work, &lwork, rwork, &info );
|
||||||
/* Check for convergence */
|
/* Check for convergence */
|
||||||
if( info > 0 ) {
|
if( info > 0 ) {
|
||||||
OutputDebugString( "The algorithm failed to compute eigenvalues.\n" );
|
LOG( "The algorithm failed to compute eigenvalues.\n" );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
/* Print eigenvalues */
|
/* Print eigenvalues */
|
||||||
@ -126,15 +126,15 @@ print_matrix_cmplx16( char* desc, int m, int n, MKL_Complex16* a, int lda ) {
|
|||||||
int i, j;
|
int i, j;
|
||||||
String8 newline = str8_lit("\n");
|
String8 newline = str8_lit("\n");
|
||||||
String8 header = str8_pushf(scratch.arena, "\n %s\n", desc );
|
String8 header = str8_pushf(scratch.arena, "\n %s\n", desc );
|
||||||
OutputDebugString(header.str);
|
LOG(header.str);
|
||||||
//printf("\n %s \n", desc);
|
//printf("\n %s \n", desc);
|
||||||
for( i = 0; i < m; i++ ) {
|
for( i = 0; i < m; i++ ) {
|
||||||
for( j = 0; j < n; j++ ) {
|
for( j = 0; j < n; j++ ) {
|
||||||
String8 outstr = str8_pushf(scratch.arena, " (%6.2f,%6.2f)", a[i+j*lda].real, a[i+j*lda].imag );
|
String8 outstr = str8_pushf(scratch.arena, " (%6.2f,%6.2f)", a[i+j*lda].real, a[i+j*lda].imag );
|
||||||
OutputDebugString(outstr.str);
|
LOG(outstr.str);
|
||||||
//printf(" (%6.2f,%6.2f)", a[i+j*lda].real, a[i+j*lda].imag );
|
//printf(" (%6.2f,%6.2f)", a[i+j*lda].real, a[i+j*lda].imag );
|
||||||
}
|
}
|
||||||
OutputDebugString(newline.str);
|
LOG(newline.str);
|
||||||
//printf("\n");
|
//printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ test_mkl_dsyevd(void) {
|
|||||||
-3.18, 7.21, -7.42, 8.54, 2.51
|
-3.18, 7.21, -7.42, 8.54, 2.51
|
||||||
};
|
};
|
||||||
/* Executable statements */
|
/* Executable statements */
|
||||||
OutputDebugString( " DSYEVD Example Program Results\n" );
|
LOG( " DSYEVD Example Program Results\n" );
|
||||||
/* Query and allocate the optimal workspace */
|
/* Query and allocate the optimal workspace */
|
||||||
lwork = -1;
|
lwork = -1;
|
||||||
liwork = -1;
|
liwork = -1;
|
||||||
@ -239,7 +239,7 @@ test_mkl_dsyevd(void) {
|
|||||||
&liwork, &info );
|
&liwork, &info );
|
||||||
/* Check for convergence */
|
/* Check for convergence */
|
||||||
if( info > 0 ) {
|
if( info > 0 ) {
|
||||||
OutputDebugString( "The algorithm failed to compute eigenvalues.\n" );
|
LOG( "The algorithm failed to compute eigenvalues.\n" );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
/* Print eigenvalues */
|
/* Print eigenvalues */
|
||||||
@ -257,15 +257,15 @@ void print_matrix( char* desc, int m, int n, double* a, int lda ) {
|
|||||||
int i, j;
|
int i, j;
|
||||||
//printf( "\n %s\n", desc );
|
//printf( "\n %s\n", desc );
|
||||||
String8 header = str8_pushf(scratch.arena, "\n %s\n", desc);
|
String8 header = str8_pushf(scratch.arena, "\n %s\n", desc);
|
||||||
OutputDebugString(header.str);
|
LOG(header.str);
|
||||||
for( i = 0; i < m; i++ ) {
|
for( i = 0; i < m; i++ ) {
|
||||||
for( j = 0; j < n; j++ )
|
for( j = 0; j < n; j++ )
|
||||||
{
|
{
|
||||||
String8 out = str8_pushf(scratch.arena, " %6.2f", a[i+j*lda] );
|
String8 out = str8_pushf(scratch.arena, " %6.2f", a[i+j*lda] );
|
||||||
OutputDebugString(out.str);
|
LOG(out.str);
|
||||||
//printf( " %6.2f", a[i+j*lda] );
|
//printf( " %6.2f", a[i+j*lda] );
|
||||||
}
|
}
|
||||||
OutputDebugString(str8_lit("\n").str);
|
LOG(str8_lit("\n").str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
timeBuild.ctm
BIN
timeBuild.ctm
Binary file not shown.
Loading…
Reference in New Issue
Block a user