diff --git a/src/kernel/calc_verletbuf.c b/src/kernel/calc_verletbuf.c index 6d9ada0..a5bb7c4 100644 --- a/src/kernel/calc_verletbuf.c +++ b/src/kernel/calc_verletbuf.c @@ -275,7 +275,7 @@ static real ener_drift(const att_t *att,int natt, s = sqrt(s2); c_exp = exp(-rb*rb/(2*s2))/sqrt(2*M_PI); - c_erfc = 0.5*erfc(rb/(sqrt(2*s2))); + c_erfc = 0.5*gmx_erfc(rb/(sqrt(2*s2))); /* Exact contribution of a mass to the energy drift * for a potential with derivative -d and second derivative dd @@ -443,7 +443,7 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop,real boxvol, { beta = calc_ewaldcoeff(ir->rcoulomb,ir->ewald_rtol); beta_r = beta*ir->rcoulomb; - d_el = elfac*(2*beta*exp(-beta_r*beta_r)/(sqrt(M_PI)*ir->rcoulomb) + erfc(beta_r)/(ir->rcoulomb*ir->rcoulomb)); + d_el = elfac*(2*beta*exp(-beta_r*beta_r)/(sqrt(M_PI)*ir->rcoulomb) + gmx_erfc(beta_r)/(ir->rcoulomb*ir->rcoulomb)); } else { diff --git a/src/mdlib/forcerec.c b/src/mdlib/forcerec.c index 59a78f6..4dcc1d7 100644 --- a/src/mdlib/forcerec.c +++ b/src/mdlib/forcerec.c @@ -1760,7 +1760,7 @@ void init_interaction_const(FILE *fp, ic->ewaldcoeff = fr->ewaldcoeff; if (shCoul) { - ic->sh_ewald = erfc(ic->ewaldcoeff*ic->rcoulomb); + ic->sh_ewald = gmx_erfc(ic->ewaldcoeff*ic->rcoulomb); } else { diff --git a/src/mdlib/gmx_wallcycle.c b/src/mdlib/gmx_wallcycle.c index d58bad3..4b5b6ea 100644 --- a/src/mdlib/gmx_wallcycle.c +++ b/src/mdlib/gmx_wallcycle.c @@ -691,9 +691,10 @@ void wallcycle_print(FILE *fplog, int nnodes, int npme, double realtime, fprintf(fplog, "%s\n", hline); print_gputimes(fplog, "Pair list H2D", gpu_t->pl_h2d_c, gpu_t->pl_h2d_t, tot_gpu); - print_gputimes(fplog, "X / q H2D", + print_gputimes(fplog, "X / q H2D", gpu_t->nb_c, gpu_t->nb_h2d_t, tot_gpu); + { // C99 style in .c sources not supported not supported in VS2010 char *k_log_str[2][2] = { {"Nonbonded F kernel", "Nonbonded F+ene k."}, {"Nonbonded F+prune k.", "Nonbonded F+ene+prune k."}}; @@ -739,6 +740,7 @@ void wallcycle_print(FILE *fplog, int nnodes, int npme, double realtime, } fprintf(stderr,"\n\n%s\n",buf); } + } // end of de-C99'ified block } if (cycles[ewcMoveE] > tot*0.05) diff --git a/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu b/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu index c5844f6..432bdce 100644 --- a/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu +++ b/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu @@ -34,7 +34,11 @@ */ #include "stdlib.h" -#include "unistd.h" +#if defined (_MSC_VER) + #include "stdint.h" +#else + #include "unistd.h" +#endif #include "smalloc.h" #include "types/simple.h" @@ -392,6 +396,16 @@ void nbnxn_cuda_launch_cpyback(nbnxn_cuda_ptr_t cu_nb, /* For safety reasons set a few (5%) forces to NaN. This way even if the polling "hack" fails with some future NVIDIA driver we'll get a crash. */ + + #if defined (_MSC_VER) + // This is a quick hack, please check + static float NAN; + { + uint32_t _nan = 0x7fffffffUL; + NAN = *(float *)&_nan; + } + #endif + for (int i = adat_begin; i < 4*adat_last + 2; i += (adat_last - adat_begin)/20) { nbatom->out[0].f[i] = NAN; @@ -512,7 +526,11 @@ void nbnxn_cuda_wait_gpu(nbnxn_cuda_ptr_t cu_nb, while (*signal_bytes != signal_pattern) { /* back off, otherwise we get stuck. why??? */ + #if defined (_MSC_VER) + clock();clock();clock(); + #else usleep(0); + #endif } } diff --git a/src/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.c b/src/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.c index 454aec6..a97eea8 100644 --- a/src/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.c +++ b/src/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.c @@ -269,7 +269,7 @@ nbnxn_kernel_gpu_ref(const nbnxn_pairlist_t *nbl, if (bEner) { - vcoul = qq*((int_bit - erf(iconst->ewaldcoeff*r))*rinv - int_bit*iconst->sh_ewald); + vcoul = qq*((int_bit - gmx_erf(iconst->ewaldcoeff*r))*rinv - int_bit*iconst->sh_ewald); } } diff --git a/src/mdlib/nbnxn_kernels/nbnxn_kernel_sse_inner.h b/src/mdlib/nbnxn_kernels/nbnxn_kernel_sse_inner.h index 69c1ec3..6395662 100644 --- a/src/mdlib/nbnxn_kernels/nbnxn_kernel_sse_inner.h +++ b/src/mdlib/nbnxn_kernels/nbnxn_kernel_sse_inner.h @@ -47,6 +47,7 @@ { int cj,aj,ajx,ajy,ajz; + __m128i mask_int; #ifdef ENERGY_GROUPS int egps_j; @@ -224,7 +225,7 @@ #ifdef CHECK_EXCLS #ifndef GMX_AVX_HERE /* Load integer interaction mask */ - __m128i mask_int = _mm_set1_epi32(l_cj[cjind].excl); +/* __m128i */ mask_int = _mm_set1_epi32(l_cj[cjind].excl); /* The is no unequal sse instruction, so we need a not here */ int_SSE0 = gmx_mm_castsi128_pr(_mm_cmpeq_epi32(_mm_andnot_si128(mask_int,mask0),zero_SSE)); @@ -710,19 +711,15 @@ VLJ_SSE3 = gmx_and_pr(VLJ_SSE3,wco_SSE3); #endif #endif + #ifndef ENERGY_GROUPS VvdwtotSSE = gmx_add_pr(VvdwtotSSE, -#ifndef HALF_LJ - gmx_sum4_pr( -#else - gmx_add_pr( -#endif - VLJ_SSE0,VLJ_SSE1 -#ifndef HALF_LJ - , - VLJ_SSE2,VLJ_SSE3 -#endif - )); + #ifndef HALF_LJ + gmx_sum4_pr(VLJ_SSE0,VLJ_SSE1,VLJ_SSE2,VLJ_SSE3) + #else + gmx_add_pr(VLJ_SSE0,VLJ_SSE1) + #endif + ); #else add_ener_grp(VLJ_SSE0,vvdwtp[0],egp_jj); add_ener_grp(VLJ_SSE1,vvdwtp[1],egp_jj); diff --git a/src/mdlib/tables.c b/src/mdlib/tables.c index efc0752..590f64a 100644 --- a/src/mdlib/tables.c +++ b/src/mdlib/tables.c @@ -129,7 +129,7 @@ typedef struct { static double v_ewald_lr(double beta,double r) { - return erf(beta*r)/r; + return gmx_erf(beta*r)/r; } void table_spline3_fill_ewald_lr(real *tabf,real *tabv, @@ -309,7 +309,7 @@ real ewald_spline3_table_scale(real ewaldcoeff,real rc) sc_f = sqrt(erf_x_d3/(6*4*ftol*ewaldcoeff))*ewaldcoeff; /* Energy tolerance: 10x more accurate than the cut-off jump */ - etol = 0.1*erfc(ewaldcoeff*rc); + etol = 0.1*gmx_erfc(ewaldcoeff*rc); sc_e = pow(erf_x_d3/(6*12*sqrt(3)*etol),1.0/3.0)*ewaldcoeff; return max(sc_f,sc_e); diff --git a/src/tools/geminate.c b/src/tools/geminate.c index 20f2430..23892cf 100644 --- a/src/tools/geminate.c +++ b/src/tools/geminate.c @@ -1021,6 +1021,7 @@ extern void takeAwayBallistic(double *ct, double *t, int len, real tMax, int nex p = nexp*2+1; /* Number of parameters. */ #ifdef HAVE_LIBGSL + { const gsl_multifit_fdfsolver_type *T = gsl_multifit_fdfsolver_lmsder; @@ -1178,7 +1179,7 @@ extern void takeAwayBallistic(double *ct, double *t, int len, real tMax, int nex gsl_multifit_fdfsolver_free(s); gsl_matrix_free(covar); fflush(stdout); - +} #else /* We have no gsl. */ fprintf(stderr, "Sorry, can't take away ballistic component without gsl. " diff --git a/src/tools/gmx_kinetics.c b/src/tools/gmx_kinetics.c index f2c599a..4d45067 100644 --- a/src/tools/gmx_kinetics.c +++ b/src/tools/gmx_kinetics.c @@ -83,7 +83,7 @@ typedef struct { real *d2_replica; } t_remd_data; -static char *itoa(int i) +static char *gmx_itoa(int i) { static char ptr[12];