cudnn_frontend_Logging.h
iostream
fstream
cstring
cudnn_backend_base.h
cudnn_frontend_utils.h
cudnn_frontend_Errata.h
cudnn_frontend.h
cudnn.h
cudnn_frontend_Logging.h
fstream
ostream
iostream
cstring
cudnn_backend_base.h
cudnn_frontend_VariantPack.h
cudnn_frontend_Engine.h
cudnn_frontend_EngineConfig.h
cudnn_frontend_MatMulDesc.h
cudnn_frontend_Heuristics.h
cudnn_frontend_PointWiseDesc.h
cudnn_frontend_get_plan.h
cudnn_frontend_Errata.h
cudnn_frontend_Logging.h
cudnn_frontend_Tensor.h
cudnn_frontend_EngineConfigGenerator.h
cudnn_frontend_ExecutionPlanCache.h
cudnn_frontend_Operation.h
cudnn_frontend_Reorder_Tensor.h
cudnn_frontend_ExecutionPlan.h
cudnn_frontend_ConvDesc.h
cudnn_frontend_OperationGraph.h
cudnn_frontend.h
cudnn_frontend_find_plan.h
cudnn_frontend_ReductionDesc.h
cudnn_frontend_utils.h
cudnn_frontend::ConditionalStreamer
cudnn_frontend

    /*
    *Copyright(c)2021,NVIDIACORPORATION.Allrightsreserved.
    *
    *Permissionisherebygranted,freeofcharge,toanypersonobtaininga
    *copyofthissoftwareandassociateddocumentationfiles(the"Software"),
    *todealintheSoftwarewithoutrestriction,includingwithoutlimitation
    *therightstouse,copy,modify,merge,publish,distribute,sublicense,
    *and/orsellcopiesoftheSoftware,andtopermitpersonstowhomthe
    *Softwareisfurnishedtodoso,subjecttothefollowingconditions:
    *
    *Theabovecopyrightnoticeandthispermissionnoticeshallbeincludedin
    *allcopiesorsubstantialportionsoftheSoftware.
    *
    *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND,EXPRESSOR
    *IMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOFMERCHANTABILITY,
    *FITNESSFORAPARTICULARPURPOSEANDNONINFRINGEMENT.INNOEVENTSHALL
    *THEAUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANYCLAIM,DAMAGESOROTHER
    *LIABILITY,WHETHERINANACTIONOFCONTRACT,TORTOROTHERWISE,ARISING
    *FROM,OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOROTHER
    *DEALINGSINTHESOFTWARE.
    */

    #pragmaonce

    #include<iostream>
    #include<fstream>
    #include<cstring>

    #include"cudnn_backend_base.h"
    namespacecudnn_frontend{
    inlinebool&
    isLoggingEnabled(){
    staticboollog_enabled=std::getenv("CUDNN_FRONTEND_LOG_INFO")&&std::strncmp(std::getenv("CUDNN_FRONTEND_LOG_INFO"),"0",1);
    returnlog_enabled;
    }

    inlinestd::ostream&
    getStream(){
    staticstd::ofstreamoutFile;
    staticstd::ostream&stream=std::getenv("CUDNN_FRONTEND_LOG_FILE")
    ?(std::strncmp(std::getenv("CUDNN_FRONTEND_LOG_FILE"),"stdout",6)==0
    ?std::cout:(std::strncmp(std::getenv("CUDNN_FRONTEND_LOG_FILE"),"stderr",6)==0
    ?std::cerr:(outFile.open(std::getenv("CUDNN_FRONTEND_LOG_FILE"),std::ios::out),outFile)))
    :(isLoggingEnabled()=false,std::cout);
    returnstream;
    }

    classConditionalStreamer{
    private:
    std::ostream&stream;
    public:
    ConditionalStreamer(std::ostream&stream_):stream(stream_){}

    template<typenameT>
    constConditionalStreamer&
    operator<< (constT&t)const{
    if(isLoggingEnabled()){stream<<t;}
    return*this;
    }

    constConditionalStreamer&
    operator<< (std::ostream&(*spl)(std::ostream&))const{
    if(isLoggingEnabled()){stream<<spl;}
    return*this;
    }
    };

    inlineConditionalStreamer&
    getLogger(){
    staticConditionalStreameropt(getStream());
    returnopt;
    }

    static
    std::ostream&
    operator << (std::ostream&os,constBackendDescriptor&desc){
    if(isLoggingEnabled()){os<<desc.describe();}
    returnos;
    }
    }