Permalink
Browse files

Switch MSVC to LLVM compiler for Windows builds (#1264)

* Switch MSVC to LLVM compiler

* Fix compilation of core

* Fix compilation of adc

* Fix compilation of ccdensity

* Fix compilation of ccenergy

* Fix compilation of ccresponse

* Fix compilation of cctriples

* Fix compilation of libfock

* Fix compilation of libmints

* Fix compilation of libqt

* Fix compilation of libtrans

* Fix compilation of mrcc

* Fix compilation of occ

* Fix compilation of optking

* Fix compilation of psimrcc

* Update passing Windows tests
  • Loading branch information...
raimis authored and andysim committed Oct 1, 2018
1 parent c9be896 commit 6d4349383a41429a5060cc14aaaace949cc34a70
View
@@ -13,6 +13,7 @@ install:
- conda config --set always_yes yes
- conda create --channel conda-forge
--name %CONDA_ENV%
cmake
deepdiff
intel-openmp=2018.0.3
mkl-devel=2018.0.3
@@ -27,19 +28,16 @@ install:
- conda list
before_build:
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
- set SOURCE_FOLDER=%APPVEYOR_BUILD_FOLDER%
- set BUILD_FOLDER=%SOURCE_FOLDER%\build
- set INSTALL_FOLDER=%SOURCE_FOLDER%\install
- mkdir %BUILD_FOLDER% & cd %BUILD_FOLDER%
# TODO fix OpenMP
- cmake -G Ninja
-DCMAKE_BUILD_TYPE=%CONFIGURATION%
-DCMAKE_INSTALL_PREFIX=%INSTALL_FOLDER%
-DCMAKE_C_FLAGS="/wd4018 /wd4101 /wd4996"
-DCMAKE_CXX_FLAGS="/wd4251 /wd4267"
-DENABLE_OPENMP=OFF
-DCMAKE_C_COMPILER=clang-cl
-DCMAKE_CXX_COMPILER=clang-cl
-DENABLE_XHOST=OFF
-DMAX_AM_ERI=5
%SOURCE_FOLDER%
@@ -74,11 +72,9 @@ test_script:
#
# Failling tests:
# ci-property
# sapt-dft1 sapt1 tu5-sapt
# pywrap-db1
#
- ctest --build-config %CONFIGURATION%
--exclude-regex "^(cbs-delta-energy|cbs-xtpl-gradient|dfmp2-ecp|fnocc2|mp2-module|scf5|psimrcc-sp1|pywrap-all|pywrap-cbs1|ci-property|pywrap-db1|sapt-dft1|sapt1|tu5-sapt)$"
--exclude-regex "^(cbs-delta-energy|cbs-xtpl-gradient|dfmp2-ecp|fnocc2|mp2-module|scf5|psimrcc-sp1|pywrap-all|pywrap-cbs1|ci-property)$"
--label-regex quick
--output-on-failure
--parallel %NUMBER_OF_PROCESSORS%
@@ -87,7 +83,7 @@ after_test:
# Run failling tests, but their results are ignored
# TODO fix the tests
- ctest --build-config %CONFIGURATION%
--tests-regex "^(ci-property|pywrap-db1|sapt-dft1|sapt1|tu5-sapt)$"
--tests-regex "^(ci-property)$"
--output-on-failure
--parallel %NUMBER_OF_PROCESSORS% & exit 0
- python %INSTALL_FOLDER%\bin\psi4 --test & exit 0
View
@@ -224,14 +224,16 @@ void py_reopen_outfile() {
if (outfile_name == "stdout") {
// outfile = stdout;
} else {
outfile = std::make_shared<PsiOutStream>(outfile_name, std::ostream::app);
auto mode = std::ostream::app;
outfile = std::make_shared<PsiOutStream>(outfile_name, mode);
if (!outfile) throw PSIEXCEPTION("Psi4: Unable to reopen output file.");
}
}
void py_be_quiet() {
py_close_outfile();
outfile = std::make_shared<PsiOutStream>("/dev/null", std::ostream::app);
auto mode = std::ostream::app;
outfile = std::make_shared<PsiOutStream>("/dev/null", mode);
if (!outfile) throw PSIEXCEPTION("Psi4: Unable to redirect output to /dev/null.");
}
@@ -1219,11 +1221,13 @@ PYBIND11_MODULE(core, core) {
core.def("opt_clean", py_psi_opt_clean, "Cleans up the optimizer's scratch files.");
core.def("get_options", py_psi_get_options, py::return_value_policy::reference, "Get options");
core.def("set_output_file", [](const std::string ofname) {
outfile = std::make_shared<PsiOutStream>(ofname, std::ostream::trunc);
auto mode = std::ostream::trunc;
outfile = std::make_shared<PsiOutStream>(ofname, mode);
outfile_name = ofname;
});
core.def("set_output_file", [](const std::string ofname, bool append) {
outfile = std::make_shared<PsiOutStream>(ofname, (append ? std::ostream::app : std::ostream::trunc));
auto mode = append ? std::ostream::app : std::ostream::trunc;
outfile = std::make_shared<PsiOutStream>(ofname, mode);
outfile_name = ofname;
});
core.def("get_output_file", []() { return outfile_name; });
@@ -74,7 +74,8 @@ void ADCWfn::rhf_diagonalize(int irrep, int num_root, bool first, double omega_i
for (int I = 0; I < rpi_[irrep]; I++) lambda_o[I] = omega_guess_->get(irrep, I);
shift_denom4(irrep, omega_in);
auto printer = std::make_shared<PsiOutStream>("iter.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("iter.dat", mode);
timer_on("SEM");
while (converged < rpi_[irrep] && iter < sem_max_) {
@@ -208,7 +208,8 @@ void densgrid_RHF(std::shared_ptr<Wavefunction> wfn, Options &options) {
int zsteps = (int)((zmax - zmin) / step_size + 1);
// Prep .dx file
auto printer = std::make_shared<PsiOutStream>("density.dx", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("density.dx", mode);
printer->Printf("# Output from Psi4 calculation\n");
printer->Printf("# Electronic density (in e/ang^3) for: \n");
printer->Printf("object 1 class gridpositions counts %d %d %d\n", xsteps, ysteps, zsteps);
@@ -255,7 +256,8 @@ void densgrid_RHF(std::shared_ptr<Wavefunction> wfn, Options &options) {
printer->Printf("\n");
printer->Printf("end");
auto printer2 = std::make_shared<PsiOutStream>("molecule.dx", std::ostream::trunc);
auto mode2 = std::ostream::trunc;
auto printer2 = std::make_shared<PsiOutStream>("molecule.dx", mode2);
printer2->Printf("%d\n", molecule->natom());
printer2->Printf("Initial atomic coordinates\n");
@@ -57,7 +57,8 @@ void CCEnergyWavefunction::analyze() {
max = 9;
min = 0;
width = (max - min) / (num_div);
auto printer = std::make_shared<PsiOutStream>("tamps.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("tamps.dat", mode);
amp_array = init_array(num_div);
nvir = moinfo_.virtpi[0];
@@ -111,7 +112,8 @@ void CCEnergyWavefunction::analyze() {
max = 2;
min = -5;
width = (max - min) / (num_div);
auto printer2 = std::make_shared<PsiOutStream>("t1amps.dat", std::ostream::app);
auto mode2 = std::ostream::app;
auto printer2 = std::make_shared<PsiOutStream>("t1amps.dat", mode2);
amp_array = init_array(num_div);
global_dpd_->file2_init(&T1, PSIF_CC_OEI, 0, 0, 1, "tIA");
@@ -66,7 +66,8 @@ void analyze(const char *pert, int irrep, double omega) {
width = (max - min) / (num_div);
sprintf(lbl, "X_%s_%5.3f", pert, omega);
auto printer = std::make_shared<PsiOutStream>(lbl, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(lbl, mode);
// ffile(&efile, lbl, 1);
amp_array = init_array(num_div);
@@ -124,7 +125,8 @@ void analyze(const char *pert, int irrep, double omega) {
width = (max - min) / (num_div);
sprintf(lbl, "X1_%s_%5.3f", pert, omega);
auto printer2 = std::make_shared<PsiOutStream>(lbl, std::ostream::app);
auto mode2 = std::ostream::app;
auto printer2 = std::make_shared<PsiOutStream>(lbl, mode2);
// ffile(&efile, lbl, 1);
amp_array = init_array(num_div);
@@ -189,7 +189,8 @@ void scatter(std::shared_ptr<Molecule> molecule, Options &options, double step,
// Write Out the Tensor Derivatives to File tender.dat //
// Outfile derivs("tender.dat", "w");
auto derivs = std::make_shared<PsiOutStream>("tender.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto derivs = std::make_shared<PsiOutStream>("tender.dat", mode);
derivs->Printf("******************************************************\n");
derivs->Printf("********** **********\n");
derivs->Printf("********** TENSOR DERIVATIVES **********\n");
@@ -151,7 +151,8 @@ double ET_RHF() {
global_dpd_->buf4_mat_irrep_init(&Dints, h);
global_dpd_->buf4_mat_irrep_rd(&Dints, h);
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);
/* each thread gets its own F buffer to assign memory and read blocks
@@ -123,7 +123,8 @@ double ET_UHF_AAA() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);
printer->Printf("Spin Case: AAA\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
@@ -169,7 +169,8 @@ double ET_UHF_AAB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: AAB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
@@ -168,7 +168,8 @@ double ET_UHF_ABB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: ABB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
@@ -122,7 +122,8 @@ double ET_UHF_BBB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: BBB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
@@ -129,7 +129,8 @@ double EaT_RHF() {
global_dpd_->buf4_mat_irrep_init(&Dints, h);
global_dpd_->buf4_mat_irrep_rd(&Dints, h);
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);
/* each thread gets its own F buffer to assign memory and read blocks
@@ -578,7 +578,8 @@ void DirectJK::build_JK(std::vector<std::shared_ptr<TwoBodyAOInt> >& ints,
}
if (bench_) {
auto printer = std::make_shared<PsiOutStream>("bench.dat",std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("bench.dat", mode);
size_t ntri = nshell * (nshell + 1L) / 2L;
size_t possible_shells = ntri * (ntri + 1L) / 2L;
printer->Printf( "Computed %20zu Shell Quartets out of %20zu, (%11.3E ratio)\n", computed_shells, possible_shells, computed_shells / (double) possible_shells);
@@ -4448,7 +4448,8 @@ void OctreeGridBlocker::block()
int index = 0;
int unique_block = 0;
if (bench_) {
printer=std::make_shared<PsiOutStream>("finished_blocks.dat",std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>("finished_blocks.dat", mode);
//outfile->Printf(fh_blocks, "# %4s %15s %15s %15s %15s\n", "ID", "X", "Y", "Z", "W");
}
for (size_t A = 0; A < completed_tree.size(); A++) {
@@ -4487,7 +4488,8 @@ void OctreeGridBlocker::block()
}
if (bench_) {
printer=std::make_shared<PsiOutStream>("extents.dat",std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>("extents.dat", mode);
//FILE* fh_extents = fopen("extents.dat","w");
//outfile->Printf(fh_extents," %4s %15s %15s %15s %15s\n","ID","X","Y","Z","R");
std::shared_ptr<BasisSet> basis = extents_->basis();
@@ -4504,7 +4506,8 @@ void OctreeGridBlocker::block()
for (int i = 2; i < 20; i++) {
std::stringstream ss;
ss << "extents" << i << ".dat";
printer=std::make_shared<PsiOutStream>(ss.str(),std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>(ss.str(), mode);
//FILE* fh_extents = fopen(ss.str().c_str(),"w");
//outfile->Printf(fh_extents," %4s %15s %15s %15s %15s\n","ID","X","Y","Z","R");
extents_->set_delta(pow(10.0,-i));
@@ -1559,7 +1559,8 @@ void benchmark_math(double min_time) {
ops.push_back("fabs");
// In case the compiler gets awesome
auto printer = std::make_shared<PsiOutStream>("dump.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("dump.dat", mode);
#define LOOP_SIZE 10000
#define UNROLL_SIZE 10
@@ -2841,8 +2841,8 @@ void Matrix::save(const std::string &filename, bool append, bool saveLowerTriang
if (symmetry_ && saveLowerTriangle)
throw PSIEXCEPTION("Matrix::save: Unable to save lower triangle for non-totally symmetric matrix.");
std::shared_ptr<psi::PsiOutStream> printer =
std::make_shared<PsiOutStream>(filename, (append ? std::ostream::app : std::ostream::trunc));
auto mode = append ? std::ostream::app : std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>(filename, mode);
printer->Printf("%s\n", name_.c_str());
printer->Printf("symmetry %d\n", symmetry_);
@@ -1246,7 +1246,8 @@ void Molecule::print_out_of_planes() const {
void Molecule::save_xyz_file(const std::string &filename, bool save_ghosts) const {
double factor = (units_ == Angstrom ? 1.0 : pc_bohr2angstroms);
auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>(filename, mode);
int N = natom();
if (!save_ghosts) {
@@ -49,7 +49,8 @@ MoldenWriter::MoldenWriter(std::shared_ptr<Wavefunction> wavefunction) : wavefun
void MoldenWriter::write(const std::string &filename, std::shared_ptr<Matrix> Ca, std::shared_ptr<Matrix> Cb,
std::shared_ptr<Vector> Ea, std::shared_ptr<Vector> Eb, std::shared_ptr<Vector> OccA,
std::shared_ptr<Vector> OccB, bool dovirtual) {
auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(filename, mode);
int atom;
@@ -598,7 +599,8 @@ void NBOWriter::write(const std::string &filename) {
MintsHelper helper(wavefunction_->basisset(), wavefunction_->options(), 0);
SharedMatrix sotoao = helper.petite_list()->sotoao();
auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(filename, mode);
// Get the basis set and molecule from the wavefuntion
BasisSet &basisset = *wavefunction_->basisset().get();
@@ -188,7 +188,8 @@ void dx_write(std::shared_ptr<Wavefunction> wfn, Options &options, double **D) {
int zsteps = (int)((zmax - zmin) / step_size + 1);
// Prep .dx file
auto printer = std::make_shared<PsiOutStream>("density.dx", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("density.dx", mode);
printer->Printf("# Output from Psi4 calculation\n");
printer->Printf("# Electronic density (in e/ang^3) for: \n");
printer->Printf("object 1 class gridpositions counts %d %d %d\n", xsteps, ysteps, zsteps);
@@ -1010,7 +1010,8 @@ void timer_done(void) {
gethostname(host, 40);
/* Dump the timing data to timer.dat and free the timers */
auto printer = std::make_shared<PsiOutStream>("timer.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("timer.dat", mode);
printer->Printf("\n");
printer->Printf("Host: %s\n", host);
free(host);
@@ -52,7 +52,8 @@ void fcidump_tei_helper(int nirrep, bool restricted, std::map<std::string, int>
std::string fname) {
outfile->Printf("Writing TEI integrals in FCIDUMP format to " + fname + "\n");
// Append to the file created by the fcidump function Python-side
auto intdump = std::make_shared<PsiOutStream>(fname.c_str(), std::ostream::app);
auto mode = std::ostream::app;
auto intdump = std::make_shared<PsiOutStream>(fname.c_str(), mode);
// Use the IntegralTransform object's DPD instance, for convenience
dpd_set_default(DPD_info["instance_id"]);
@@ -694,7 +694,8 @@ PsiReturnType mrcc_generate_input(SharedWavefunction ref_wfn, Options &options,
outfile->Printf("\n");
// FILE* fort55 = fopen("fort.55", "w");
auto printer = std::make_shared<PsiOutStream>("fort.55", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("fort.55", mode);
printer->Printf("%22d%22d\n", nbf, nelectron);
// Print out orbital symmetries
@@ -913,7 +914,8 @@ PsiReturnType mrcc_generate_input(SharedWavefunction ref_wfn, Options &options,
for (int h = 0; h < nirrep; ++h)
for (int n = 0; n < active_socc[h]; ++n) symm ^= h;
symm += 1; // stupid 1 based fortran
printer = std::make_shared<PsiOutStream>("fort.56", std::ostream::trunc);
auto mode2 = std::ostream::trunc;
printer = std::make_shared<PsiOutStream>("fort.56", mode2);
// FILE* fort56 = fopen("fort.56", "w");
printer->Printf("%6d%6d%6d%6d%6d 0 0%6d 0%6d%6d%6d%6d 0 0%6d 0 0 0.00 0%6lu\n",
exlevel, // # 1
@@ -118,8 +118,9 @@ void Array1d::print()
void Array1d::print(std::string out_fname)
{
std::shared_ptr<psi::PsiOutStream> printer=(out_fname=="outfile"?outfile:
std::make_shared<PsiOutStream>(out_fname,std::ostream::app));
auto mode = std::ostream::app;
auto printer = out_fname == "outfile" ? outfile
: std::make_shared<PsiOutStream>(out_fname, mode);
if (name_.length()) printer->Printf( "\n ## %s ##\n", name_.c_str());
for (int p=0; p<dim1_; p++){
printer->Printf(" %3d %10.7f \n",p,A1d_[p]);
@@ -402,8 +403,9 @@ void Array2d::print()
void Array2d::print(std::string out_fname)
{
std::shared_ptr<psi::PsiOutStream> printer=(out_fname=="outfile"?outfile:
std::make_shared<PsiOutStream>(out_fname,std::ostream::app));
auto mode = std::ostream::app;
auto printer = out_fname=="outfile" ? outfile
: std::make_shared<PsiOutStream>(out_fname, mode);
if (name_.length()) printer->Printf( "\n ## %s ##\n", name_.c_str());
print_mat(A2d_,dim1_,dim2_,out_fname);
}//
Oops, something went wrong.

0 comments on commit 6d43493

Please sign in to comment.